unixcop Admin

How to Ping a Port Number in Linux


Ping is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network. It is available for virtually all operating systems that have networking capability, including most embedded network administration software.

Port numbers belong to transport layer protocols, such as TCP and UDP. Port numbers help identify where an Internet or other network message forwarded when it arrives.

So Pinging ports is one of the most effective troubleshooting technique in order to see if a service is alive or not.

In this tutorial, we will show you how to ping a port in Linux using three different tools.

Tools to ping a Port in Linux

So You can use these tools to ping a port :

  • ‎Telnet
  • Netcat (nc)
  • ‎Network Mapper (nmap)

Ping a Specific Port via Telnet

Telnet is_an application protocol used on the Internet or local area network to provide a bidirectional interactive text-oriented communication facility using a virtual terminal connection. User data interspersed in-band with Telnet control information in an 8-bit byte oriented data connection over the Transmission Control Protocol (TCP).

  • If telnet is not installed, install it with the command below:
yum install telnet -y          #CentOS/Fedora 
sudo apt install telnet -y     #Ubuntu
  • Syntax to ping a port using telnet
telnet [address] [port number]


telnet 443

NOTE: So If the port is open telnet establishes a connection. if not it is a failure state.

  • Quit telnet by running the q command or pressing Ctrl + ].

Ping a Specific Port via Netcat

netcat (often abbreviated to nc) is a computer networking utility for reading from and writing to network connections using TCP or UDP. The command designed to be a dependable back-end that can_be used directly or easily driven by other programs and scripts.

  • If netcat is not installed, install it with the command below:
yum install netcat -y          #CentOS/Fedora 
sudo apt install netcat -y     #Ubuntu
  • Syntax to ping a port using netcat 
nc -vz [address] [port number]


nc -vz 80

As shown above, connection succeeded !

Ping a Specific Port via Nmap

Nmap (Network Mapper) is a free and open-source network scanner , Nmap used to discover hosts and services on a computer network by sending packets and analyzing the responses. The utility is also useful for finding open ports and detecting security risks.

  • If netcat is not installed, install it with the command below:
yum install nmap -y          #CentOS/Fedora 
sudo apt install nmap -y     #Ubuntu
  •  Once Nmap installed on the system, ping a specific port with the Syntax:
nmap -p [port number] [address]


nmap -p 80
  • Syntax to ping more than one port
nmap -p [number-range] [address]


nmap -p 80-93


That’s it

We illustrated how to ping a specific port in Linux.


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook