Save response to file

Download silently, fail on error, follow redirects

curl -sSL -o /tmp/result.json https://api.example.com/data

tool
curl21 commands
tags
curl

More curl commands

  • curl -o /dev/null -sS -w 'ttfb: %{time_starttransfer}s\ntotal: %{time_total}s\n' https://example.com

    Benchmark TTFB and total request time

  • curl -sI https://example.com

    Print HTTP response headers without body

  • curl -F 'file=@./report.pdf' -F 'user=alice' https://upload.example.com/api

    Multipart form-data upload with extra fields

  • curl --http2 -sI https://example.com | grep -i 'http\|alt-svc'

    Force HTTP/2 and check protocol in response

  • curl --resolve example.com:443:1.2.3.4 https://example.com

    Override DNS for a host:port pair (test behind CDN/LB)

all 21 curl commands