Juicy lil' bytes

How to Check HTTP Status Codes With cURL

Here is a shell one-liner that will pull the headers from a web server and display the HTTP/1.1 response status code(s).

cURL + grep

Use the following cURL command and pipe it to grep like so:

curl -I -s -L <http://yoururl.com> | grep "HTTP/1.1"

Run it from your command line with the appropriate URL. This runs curl in silent mode, follows any redirects, pulls the HTTP headers, and then pipes them to grep. grep will print the HTTP status code to standard output.

HTTP Status Codes

Here is a link to a detailed reference of HTTP status codes. They boil down to this concise summary by @stevelosh:

HTTP Status Code Summary (via @stevelosh)

1xx: hold on

2xx: here you go

3xx: go away

4xx: you f$*%ed up

5xx: I f$*%ed up