I'm using curl at the command line on Linux to issue HTTP requests. The response bodies are printed to standard out, which is fine, but I can't see from the man page how to get curl to print the HTTP status code from the response (404, 403 etc). Is this possible?

link|improve this question

50% accept rate
feedback

2 Answers

up vote 9 down vote accepted

This should work for you:

curl -I http://www.example.org

As an addition, to let cURL follow redirects (3xx statuses) add -L.

link|improve this answer
feedback

If you want to see the header as well as the result you can also use -v:

curl -v http://www.example.org
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.