The easiest tool to check for a website’s headers su curl
In the below example we will check a headers of google.com:
$ curl -I google.com HTTP/1.1 302 Found Cache-Control: private Content-Type: text/html; charset=UTF-8 Location: http://www.google.com.au/?gfe_rd=cr&ei=9Mb0VKXbHNLu8weZ24Bo Content-Length: 260 Date: Mon, 02 Mar 2015 20:24:20 GMT Server: GFE/2.0 Alternate-Protocol: 80:quic,p=0.08
If you wish to download a website content and also include a header then use:
$ curl -i google.com
Another option to check for a website header is by using lynx
command:
$ lynx -head -dump http://google.com HTTP/1.0 302 Found Cache-Control: private Content-Type: text/html; charset=UTF-8 Location: http://www.google.com.au/?gfe_rd=cr&ei=rcj0VMLXJcXu8wfvoIGwBw Content-Length: 262 Date: Mon, 02 Mar 2015 20:31:41 GMT Server: GFE/2.0 Alternate-Protocol: 80:quic,p=0.08
And of course wget
can also extract a website’s header with a use of --server-response
option. For example:
$ wget -q --server-response http://google.com HTTP/1.1 302 Found Cache-Control: private Content-Type: text/html; charset=UTF-8 Location: http://www.google.com.au/?gfe_rd=cr&ei=Isr0VJCHNsvu8weFwoG4Bw Content-Length: 262 Date: Mon, 02 Mar 2015 20:37:54 GMT Server: GFE/2.0 Alternate-Protocol: 80:quic,p=0.08 HTTP/1.1 200 OK Date: Mon, 02 Mar 2015 20:37:55 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1 Set-Cookie: PREF=ID=97c97a203aeb6610:FF=0:TM=1425328675:LM=1425328675:S=eXgtzGUbv53_2_TC; expires=Wed, 01-Mar-2017 20:37:55 GMT; path=/; domain=.google.com.au Set-Cookie: NID=67=hW7zo2M6vOcFnwq4vvUloeE8NxM5n6L_jbJocYSA0yirrh4QTviVmvqcLOW2WM4KjJGLi01xIa9O0PrhWaPqKBtP_hz1wINF2nW7trMfR0T2aXyEDoNuDNeUUXAAjIhB; expires=Tue, 01-Sep-2015 20:37:55 GMT; path=/; domain=.google.com.au; HttpOnly P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info." Server: gws X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN Alternate-Protocol: 80:quic,p=0.08 Accept-Ranges: none Vary: Accept-Encoding Transfer-Encoding: chunked