Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 52
    The -I option shows the response headers. The question was about the request headers. Commented Jan 5, 2013 at 14:54
  • 72
    The -I options causes curl to do an HTTP HEAD, which could change the response from the server. Better to use -v switch I believe. Commented Apr 17, 2013 at 9:10
  • 1
    If you try this with anything else than a HEAD request (like -X POST) and get "You can only select one HTTP request!" than stackoverflow.com/questions/286982/… will probably help you out. The thing is that -I does a HEAD request, like acw stated and when your curl call set up to do another call you have two HTTP requests in curl call... Commented May 15, 2014 at 9:54
  • 9
    This is a very wrong answer. (I promise I'm usually very kind on here.) 1. It does the opposite of what the OP asks. 2. It uses a request method of HEAD instead of GET or POST. 3. It should NEVER be used to "just see the headers" unless you are trying to see how your server responds differently to a HEAD as opposed to a GET. It will be the same most of the time, but not always. To see only the headers use curl -o /dev/null -D /dev/stdout. That will give the expected results 100% of the time. Commented Apr 14, 2016 at 22:29
  • 2
    Probably worth mentioning that -i prints both the response headers and body. Commented Jul 16, 2020 at 1:24