How to check TCP Port 80 (http) with telnet

This article describes how to connect to a TCP port 80 on a Web server using telnet.

HTTP Protocol Basics

HTTP[1] is a simple text protocol. So telnet lets you easily test the operation of port 80.

You can test the connection using the following Linux commands:

  1. Enter telnet SERVERNAME 80. Telnet will simply connect to the 80 host port of the specified host name.
  2. If the connection is established via TCP, telnet will respond with the following response: Connected to SERVERNAME. and Escape character is '^]'.
  3. You can retrieve the site from here by using the HTTP protocol. To do so, enter the following two lines with Enter:GET / HTTP/1.1HOST: HOSTNAME
  4. In the server response we get the HTTP status and the web page (such as HTTP / 1.1 200 OK and so on).


In the following example, we will check the page. With the help of the following Linux commands, enter the commands with enter:

telnet 80

GET / HTTP/1.1


The server will reply to HTTP and return the HTML code of the page:

[user@cl05]$telnet 80
Trying 2a00:c760:83:def:aced:ffff:b921:361f...
Connected to
Escape character is '^]'.
GET / HTTP/1.1

HTTP/1.1 301 Moved Permanently
Date: Fri, 25 Aug 2017 08:12:53 GMT
Server: Apache
X-Content-Type-Options: nosniff
Cache-Control: max-age=1209600
Expires: Fri, 08 Sep 2017 08:12:53 GMT
Content-Length: 230
Content-Type: text/html; charset=iso-8859-1

<title>301 Moved Permanently</title>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="">here</a>.</p>
Connection closed by foreign host.