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 www.example.com/test.php
are
How can I do this?
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 www.example.com/test.php
are
How can I do this?
In order to retrieve only the header, give this a try:
From the
man
page:Use wget for instance
You can do that with curl:
Result:
(for some reason, IANA decided to redirect example.com, result: no body)
curls manual page about the
-i
option:Or you can use
HEAD http://www.example.com
. The result is very similar to that produced bycurl -i 'http://example.com/'
although it seems to return more headers.You can see them with curl.
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 "https://example.com"
.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: https://superuser.com/a/1007898/429721