Check a Website Availability from the Linux Command Line

You can easily test a a website availability from the Linux command line and get the status codes from the web-server using commands like TELNET or CURL.

Check a website availability with CURL

Execute the following command to check whether a web site is up, and what status message the web server is showing:

$ curl -Is | head -1
HTTP/1.1 200 OK

Status code ‘200 OK’ means that the request has succeeded and a website is reachable.

Here is an another example that shows you how curl displays different status codes.

$ curl -Is | head -n 1
HTTP/1.1 301 Moved Permanently

You’ll notice that if you visit: you are redirected to, because I prefer to have www in my site’s URL. I do this by implementing a 301 Redirect (Permanently moved) for any visitor who goes to

You can also check the availability of a particular page on the site:

$ curl -Is | head -n 1
HTTP/1.1 200 OK

Read more: Status Code Definitions

Check a website availability with TELNET

You can also test website availability and get the response code using telnet command:

$ telnet 80
Connected to
Escape character is '^]'.

You will get the output as follows:

HTTP/1.1 200 OK
Server: nginx/1.1.10
Date: Sun, 26 May 2013 19:29:46 GMT

That also means that the website is OK.

Was it useful? Share this post with the world!

5 Replies to “Check a Website Availability from the Linux Command Line”

  1. $ curl -Is -K HEAD | head -n 1
  2. I don’t have the same results as shown in the tests above. What can be the error or problem ??

  3. Станислав says: Reply

    А если нужно тоже самое, но у сайта несколько ip, как проверить доступность сайта на каждом из них?

  4. what about persistent test?

  5. watch -n 5 curl -Is -K HEAD | head -n 1

Leave a Reply