How to ping a specific port number?

The system administrators or the operation guys need to make sure that a network service is running all the time.  When it comes to monitoring a network application from the remote, the technical operator needs to check if a service listening for a request on the server machine.

Pinging a specific port on the server from a remote machine lets us know that service on that port is up or down. A port number in the computer network is a numeric value (e.g 3425).

A network service is a software application that listens to a specific port number for a request. Once a request is received on that port it replies.

A database service, web server, or web application are a few examples of network applications.  A server may host multiple services using different port numbers.

In real life example, browsing a web page (e.g is an example where the website runs over port 80 on the hosting server for a domain and a web browser requests a web page.

We have an ICMP protocol ping command to check IP a host is reachable or not. But it only lets us know that the hosting server is up and running.  It is not sufficient to check if a  specific service is running or not on that host.

Pinging a port is the way, where we can check remotely if a serving is listing on a port or not. In this tutorial, we are explaining how to ping a port in different ways.

Use telnet to ping a specific port.

Telnet is the basic command on Windows and Linux operating systems to do a remote login.  It is an application layer protocol that uses TCP/IP as the base transport protocol.  Telnet needs an IP address and a port number, default it uses port number 23.  To ping a specific port using telnet, we need to use the following command.

# telnet <IP_Address> <PortNumber>

In place of IP address, you can also use the domain name.  Let’s see how a response to ping port 80 on the host

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

The telnet command is part of Windows, but on Linux a secure version of remote login named ssh is available. If your Linux operating system does not have the command then use the following to install it.

#yum install telnet

To exit from telenet type q.

Use Netcat(nc) command to ping a specific port.

The Linux has nc command to perform activities for UDP, TCP, and other sockets types.  It can do port scanning and other activities. Port scanning means checking if a port is opened and can be used for a data transfer.  If Linux does not have the nc command, you can install it with the yum.

# yum install nc

Following is the use of nc command to check ports on host

# nc -vz 80
Ncat: Version 7.50 ( )
Ncat: Connected to
Ncat: 0 bytes sent, 0 bytes received in 0.05 seconds.

Connect on port 80. So the port is opened.

Now connect on port 500.

# nc -vz 500
Ncat: Version 7.50 ( )
Ncat: Connection to failed: Connection timed out.
Ncat: Trying next address...
Ncat: Network is unreachable.

Connection Fails. The Port is not open.

Do we have other utilities to ping a specific port?

Yes, we can use utilities such as nmap on Linux and Powershell on windows.  But telnet is the most preferable one as this is the basic and legacy command on all types of operating systems.