
9 cURL Tricks Every Developer Should Know (I Use #6 Daily)
cURL is the Swiss Army knife of the internet. But most developers only use curl URL and call it a day. Here are 9 tricks that took my API debugging from frustrating to effortless. 1. Pretty-Print JSON Responses curl -s https://api.github.com/users/torvalds | python3 -m json.tool Or with jq : curl -s https://api.github.com/users/torvalds | jq '.name, .public_repos' No more squinting at wall-of-text JSON. 2. See Full Request/Response Headers curl -v https://httpbin.org/get 2>&1 | head -20 The -v flag shows DNS resolution, TLS handshake, all headers. Use -I for headers only: curl -I https://dev.to 3. POST JSON Data curl -X POST https://httpbin.org/post \ -H "Content-Type: application/json" \ -d '{"name": "Alex", "role": "developer"}' Forget Postman for quick tests. 4. Follow Redirects curl -L https://bit.ly/some-link Without -L , cURL stops at 301/302. Debug redirect chains: curl -L -v https://short.link 2>&1 | grep "< location" 5. Download With Progress Bar curl -# -O https://example.com
Continue reading on Dev.to Tutorial
Opens in a new tab

