Print only response headers with curl

To print only response headers with curl use following command:

$ curl -s -D – http://www.google.com -o /dev/null

Output:

HTTP/1.1 302 Found
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Location: http://www.google.co.in/?gfe_rd=cr&ei=YLBZVLDTCajV8gfJ44GwBQ
Content-Length: 261
Date: Wed, 05 Nov 2014 05:06:40 GMT
Server: GFE/2.0
Alternate-Protocol: 80:quic,p=0.01

Leave a comment