curl command snippets
Copy-paste-ready curl commands for API testing, file downloads, and HTTP debugging.
- curl command snippets
- Check HTTP Response Status Code with curl
- Download a File and Show Progress with curl
- Send a POST Request with Form Data Using curl
- Send a JSON POST Request with curl
- Test an API Endpoint with Timing Information Using curl
- View Response Headers Only with curl
- Save Cookies from a Response and Resend Them with curl
curl command snippets
Copy-paste-ready curl commands for API testing, file downloads, and HTTP debugging.
Check HTTP Response Status Code with curl
curl returns only the status code with
-w and discards the body:
curl -o /dev/null -s -w "%{http_code}\n" https://example.comDownload a File and Show Progress with curl
curl downloads a file with a progress bar:
curl -# -O https://example.com/large-file.tar.gzSend a POST Request with Form Data Using curl
curl sends URL-encoded form data:
curl -d "username=admin&password=secret" https://example.com/loginSend a JSON POST Request with curl
curl sends a JSON body with automatic Content-Type header:
curl --json '{"name":"Alice"}' https://api.example.com/usersTest an API Endpoint with Timing Information Using curl
curl shows DNS lookup, TCP connect, TLS handshake, and total transfer times:
curl -o /dev/null -s -w "DNS: %{time_namelookup}s\nConnect: %{time_connect}s\nTLS: %{time_appconnect}s\nTotal: %{time_total}s\n" https://example.comView Response Headers Only with curl
curl sends a HEAD request and displays the headers:
curl -I https://example.comSave Cookies from a Response and Resend Them with curl
curl saves cookies from a login response and reuses them:
curl -c cookies.txt -d "user=admin&pass=secret" https://example.com/login
curl -b cookies.txt https://example.com/dashboard