HTTP head with curl

When working I’m checking HTTP headers from different services and websites frequently. To make this as painless as possible I’ve made a small hack for myself.

Make a small bash script called and save it in your ~/:

curl -s -D - $1 -o /dev/null

Add an alias inside your ~/.bashrc file:

alias HEAD='~/'

To apply your changes in your current terminal window, source the .bashrc file:

$ . ~/.bashrc

Now you’re good to go. Test your new command:

HTTP/1.1 301 Moved Permanently
X-VG-WebServer: vgphoenix-web-01
Content-Type: text/html; charset=iso-8859-1
X-VG-SolveMe: uggc://
Transfer-Encoding: chunked
Date: Sun, 01 Mar 2015 08:49:19 GMT
Connection: keep-alive
X-Cache: HIT:77
Server: Commodore 64
Vary: Accept-Encoding,User-Agent
X-VG-WebCache: m323-varnish-02
X-Age: 121
Age: 0

Next time you are opening a new terminal you are able to use your new command HEAD.