Curl as a daily driver
December 21, 2019
cURL is an amazing tool, chain it along with jq and you’ve got a JSON parsing API reader right there in your shell.
But it’s so much more, so here are a few ways I’ve used it in the past.
Firstly say you want to verify a file of URLs to check they all return 200, you can do that in one line: cat file.txt |while read line; do echo -n $line returns: && curl -s --max-time 2 -o /dev/null -w "%{http_code}" $line;echo;done Outputs: www.