Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

View Only Headers with Curl

DZone's Guide to

View Only Headers with Curl

· Web Dev Zone ·
Free Resource

Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.

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)

Take a look at the Indigo.Design sample applications to learn more about how apps are created with design to code software.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}