HTTP response headers describe a server's reply, including its status and content type. curl can show headers from a normal GET response, with or without printing its body.
Header inspection is different from sending a HEAD request. --head or -I asks the server for metadata without a response body, which can be rejected or handled differently from GET. Inspecting the normal GET response avoids changing the request method just to hide the body.
Request headers describe what curl sends to the server, while response headers describe the reply. A status-only check returns just the HTTP response code when the rest of the headers are unnecessary.
Steps to show HTTP response headers with curl:
- Run a normal request with -i to print the response headers before the response body.
$ curl -i https://httpbingo.org/robots.txt HTTP/2 200 access-control-allow-credentials: true access-control-allow-origin: * content-type: text/plain; charset=utf-8 date: Fri, 06 Nov 2026 14:32:14 GMT content-length: 30 ##### snipped ##### User-agent: * Disallow: /deny
-i is the short form of --show-headers, also accepted as --include. Lowercase -h displays help.
- Print only the normal GET response headers with --dump-header - --output /dev/null.
$ curl --silent --show-error --dump-header - --output /dev/null https://httpbingo.org/robots.txt HTTP/2 200 access-control-allow-credentials: true access-control-allow-origin: * content-type: text/plain; charset=utf-8 date: Fri, 06 Nov 2026 14:32:16 GMT content-length: 30 ##### snipped #####
The single dash after --dump-header sends headers to the terminal. --output /dev/null discards the body using the Unix null device; the body is still downloaded. --silent --show-error hides the progress meter while retaining error messages.
A filename in place of the dash, such as --dump-header response-headers.txt, saves the headers to that file and overwrites any existing copy. Saved headers from authenticated requests can contain cookies, redirect targets, and other sensitive values, so redact them before sharing.
- Add --location when the URL can redirect before the final response.
$ curl -i --location 'https://httpbingo.org/redirect-to?url=/robots.txt' HTTP/2 302 access-control-allow-credentials: true access-control-allow-origin: * location: /robots.txt date: Fri, 06 Nov 2026 14:32:17 GMT content-length: 0 ##### snipped ##### HTTP/2 200 access-control-allow-credentials: true access-control-allow-origin: * content-type: text/plain; charset=utf-8 date: Fri, 06 Nov 2026 14:32:17 GMT content-length: 30 ##### snipped ##### User-agent: * Disallow: /deny
With --location, curl shows each response block in order, so the last header block is the final response after the redirect chain. --location also works with --dump-header when the body should remain separate.