When working with curl, it can give lots of excellent and detailed information, but sometimes it is too much! Today I'm fiddling with the caching headers on a client's application, so I'm only interested in seeing the headers and not the body of the response. Making a
HEAD request changes the output I get, so I really do want to
GET and then only see the headers.
Handily, when you use the
-v verbose flag with curl, it sends the output to stdout as usual, but the extra information including the headers goes to stderr. This means that I can therefore view the headers only throwing away stdout completely:
curl -v -s http://awesome-site.com 1> /dev/null
(you need the
-s to stop curl from "helpfully" printing progress bars as well)