Inspect HTTP response headers with curl

Send a HEAD request to any URL and print the status line, server, content type, caching, and redirect headers.

LinuxnetworkdeveloperDiagnosticsLow risk
Run curl -I https://example.com to see the HTTP status code and all response headers.

01Command

Command
$ curl -I https://example.com

02What it does

curl -I issues a true HEAD request, so you see headers like Content-Type, Cache-Control, and Location without transferring the body. Some servers respond differently to HEAD than GET; to see headers from a real GET, use curl -s -o /dev/null -D - URL, which discards the body and dumps headers to stdout. Follow redirects by adding -L to trace a full chain (each hop's headers appear in order), and check TLS details with -v. Pair with -H 'Header: value' to add request headers when testing an API or cache behavior.

03Risk

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • curl(1) — transfer a URL
    man7.org · technical · 2026-09-17
    Evidence: The curl man page documents -I / --head as fetching the HTTP headers only, using the HEAD method.
  • curl man page — official documentation
    curl.se · vendor-doc · 2026-09-17
    Evidence: The official curl documentation describes --head as fetching headers only and -o / --output for discarding or redirecting the body.

Last verified: 2026-09-17 · Category: Network

06Related solutions