Show headers across redirects

Follow redirects and show only request and response headers, without the body.

curl -sLv https://example.com 2>&1 | grep -E '^[<>*]'

tool
curl21 commands
tags
curlnetworkdebug

More curl commands

  • curl -so /dev/null -w 'DNS: %{time_namelookup}s\nConnect: %{time_connect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n' https://example.com

    Measure DNS lookup, connect, TTFB and total time.

  • curl -L --progress-bar -o output.file https://example.com/file.tar.gz

    Download a file, follow redirects and show a simple progress bar.

  • curl -s -u user:password https://api.example.com/endpoint | jq .

    Send an HTTP request with a username and password (Basic Authentication).

  • curl -so /dev/null -w '%{http_code}' https://example.com

    Print just the response status code. Handy in scripts.

  • curl -X POST https://api.example.com/v1/items -H 'Content-Type: application/json' -d '{"name":"foo"}'

    Send a JSON payload in a POST request.

all 21 curl commands