Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a shell command to see the headers of a HTTP request?

For example, I would like to know what the headers retrieved from are

How can I do this?

share|improve this question

In order to retrieve only the header, give this a try:

curl -I

From the man page:

(HTTP/FTP/FILE) Fetch the HTTP-header only! HTTP-servers feature the command HEAD which this uses to get nothing but the header of a document. When used on a FTP or FILE file, curl displays the file size and last modification time only.

share|improve this answer
Also, -D <file> will save the headers to a file. – coredump Mar 20 '11 at 16:02

Use wget for instance

wget -O - -o /dev/null --save-headers
share|improve this answer
yes, but i don't want to save the page on my pc.....i only want to see the headers – Damiano Mar 20 '11 at 10:22
You won't save it with this command – Dmytro Leonenko Mar 20 '11 at 11:01
Yup, you're just filling /dev/null :p -O - writes the headers to the stdout ("the console") – Lekensteyn Mar 20 '11 at 16:00

You can do that with curl:

curl -i ''


HTTP/1.0 302 Found
Server: BigIP
Connection: Keep-Alive
Content-Length: 0

(for some reason, IANA decided to redirect, result: no body)

curls manual page about the -i option:


(HTTP) Include the HTTP-header in the output. The HTTP-header includes things like server-name, date of the document, HTTP-version and more...

share|improve this answer

You can see them with curl.

share|improve this answer

Or you can use HEAD The result is very similar to that produced by curl -i '' although it seems to return more headers.

200 OK
Connection: close
Date: Sun, 20 Mar 2011 19:08:58 GMT
Server: Apache/2.2.3 (CentOS)
Content-Length: 2945
Content-Type: text/html; charset=UTF-8
Last-Modified: Wed, 09 Feb 2011 17:13:15 GMT
Client-Date: Sun, 20 Mar 2011 19:09:08 GMT
Client-Response-Num: 1
share|improve this answer

Use curl --include to include the response-headers in the top of the response-body.

or curl --verbose to see it all including SSL certificate exchanging the handshake (plus other debug information)

if the request itself and neither the response-body are not of you concern, just use curl --head

for example curl --head --no-check-certificate --url "".

You can download gnu curl already pre-compiled for the most platforms. curl is quite the useful too, especially if you would like to pipe or redirect the result inside a script.
*for example:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.