We shall take “ping a specific port” to mean that you want to verify a specific port's status for a given IP address. This is useful for troubleshooting why a service is not working properly.
This article will show you how to verify a specific network port's status by using Netcat, Nmap, and Nping.
Ping a Specific Port with Netcat
The Netcat tool is used to retrieve information about network connections and listens.
If Netcat is not installed on your Linux machine, run the command below:
Ubuntu/Debian based systems:
$ sudo apt install netcatCentOS/Red Hat based systems:
$ sudo dnf install ncOr try
$ sudo dnf install netcatYou may use Netcat to ping a specific port as follows.
nc -vzReplace <IP> and <Port> as appropriate.
For example:
$ nc -vz 192.168.0.1 22
Figure 1 - Ping a specific port with Netcat
For more options and additional help using Netcat, run the command below.
$ nc -hPing a Specific Port with the Nmap tool
The Nmap tool is typically used to scan a network host to obtain information about available ports and services.
If the Nmap tool is not already installed on your Linux machine, run the command below:
Ubuntu/Debian based systems:
$ sudo apt install nmapCentOS/Red Hat based systems:
$ sudo dnf install nmapNow, you may use Nmap to ping a specific port. The syntax i.
nmap -pFor example:
$ sudo nmap -p80 192.168.0.1
Figure - Ping a specific port with nmap
For additional options and help using Nmap, run the command below.
$ nmap -hPing a Specific Port with Nping
Nping is part of Nmap and works somewhat similar to the standard ping utility. You can use the Nping tool to ping a specific port as follows.
nping -pFor example:
$ nping -p22 192.168.0.1
Figure 2 - Ping a specific port with Nping
For additional options and help using Nping, run the command below.
$ nping -hConclusion
This article showed you how to ping a specific port with Netcat, Nmap, and Nping. Do let us know which of these tools works best for you.