curl and jq 8 cheatsheet

curl and jq 8: Files and output

6 common curl and jq 8 tasks.

Save to a file

Write the response body to a file.

curl -o page.html https://example.com

Save with the remote file name

Use the file name from the URL.

curl -O https://example.com/archive.zip

Resume a download

Continue a partial download where it stopped.

curl -C - -O https://example.com/big.iso

Upload a file

Upload a file as multipart form data.

curl -F "[email protected]" https://example.com/upload

Print only the status code

Discard the body and print the HTTP status.

curl -s -o /dev/null -w "%{http_code}\n" https://example.com

Measure response time

Print how long the request took in seconds.

curl -s -o /dev/null -w "%{time_total}\n" https://example.com

Was this page helpful?