How to Ping Specific Port Number in Linux and Windows


The ping command is a network tool for checking whether a remote system is up and running. In other words, the command determines if a certain IP address or a host are accessible. Ping uses a network layer protocol called Internet Control Message Protocol (ICMP) and is available on all operating systems.

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

In this tutorial, you will learn how to ping a port in Windows and Linux using different tools.

How to ping a specific port number.


  • A Linux or Windows system
  • Access to the command line
  • An account with sudo/admin privileges

Can You Ping a Specific Port?

Network devices use ICMP to send error messages and information on whether communication with an IP address is successful or not. ICMP differs from transport protocols as ICMP is not used to exchange data between systems.

Ping uses ICMP packets, and ICMP does not use port numbers which means a port can’t be pinged. However, we can use ping with a similar intention – to check if a port is open or not.

Some network tools and utilities can simulate an attempt to establish a connection to a specific port and wait to see if the target host responds. If there is a response, the target port is open. If not, the target port is closed, or the host is unable to accept a connection because there is no service configured to listen for connections on that port.

How to Ping a Specific Port in Linux?

You can use three tools to ping a port in Linux:

See our tutorial on how to use the ping command in Linux to learn about additional ping options and variations in Linux.

Ping a Specific Port Using Telnet

Telnet is a protocol used for interactive communication with the target host via a virtual terminal connection.

1. To check whether telnet is already installed, open a terminal window and enter telnet.

Install Telnet on Linux.

2. If telnet is not installed, install it using the following command

  • For CentOS/Fedora: yum -y install telnet
  • For Ubuntu: sudo apt install telnet

3. To ping a port using telnet, enter the following command in the terminal:

telnet <address> <port_number>

The <address> syntax is the domain or the IP address of the host, while <port_number> is the port you want to ping.

telnet 443
Ping a port in Linux using Telnet

If the port is open, telnet establishes a connection. Otherwise, it states a failure.

4. To quit telnet, press Ctrl + ] and run the q command.

Note:: Learn how Telnet differs from SSH.

Ping a Specific Port Using Netcat

Netcat (nc) reads and writes from connections using TCP and UDP protocols. This command-line tool can perform many network operations.

1. To check if netcat is installed:

  • For Debian, Ubuntu, and Mint: enter netcat -h
  • For Fedora, Red Hat Enterprise Linux, and CentOS: ncat -h

2. If netcat is not installed, run the following command in the terminal:

sudo apt install netcat

3. To ping a port using netcat enter the following:

nc -vz <address> <port_number>
Ping a port using netcat

The output informs the user if the connection to the specified port is successful or not. If it is successful, the port is open.

Ping a Specific Port Using Nmap

Nmap is a network tool used for vulnerability scanning and network discovery. The utility is also useful for finding open ports and detecting security risks.

Important: Be aware of legal ramifications regarding improper Nmap use, for example, flooding a network or crashing a system.

1. Check if you have Nmap installed by entering nmap -version in the terminal.

Check nmap version on Linux

If Nmap is installed, the output informs the user about the app version and platform it runs on.

2. If there is no Nmap on your system, enter the following command:

  • For CentOS or RHEL Linux: sudo yum install nmap
  • For Ubuntu or Debian Linux: sudo apt install nmap

3. Once Nmap is installed on the system, use the following command to ping a specific port:

nmap -p <port_number> <address>
Ping a port using nmap on Linux

The output informs the user about the port’s state and service type, latency, and the time elapsed until the completion of the task.

4. To ping more than one port, enter nmap -p <number-range> <address>.

The <number-range> syntax is the range of port numbers you want to ping, separated by a hyphen.

For example:

nmap -p 88-93
Ping several ports using nmap on Linux

Learn in-depth how to use nmap to scan ports with our guide How To Scan & Find All Open Ports With Nmap.

How to Ping a Specific Port in Windows?

There are two ways to ping a port in Windows:

  • Telnet
  • PowerShell

Ping a Port Using Telnet

Before using telnet, make sure it is activated:

1. Open the Control Panel.

2. Click Programs, and then Programs and Features.

3. Select Turn Windows features on or off.

4. Find Telnet Client and check the box. Click OK.

You activated the Telnet Client on the system.

After completing the activation, you are ready to ping a port using telnet.

Follow these steps:

1. Search for “cmd” in the start menu. Click the Command Prompt.

2. In the command prompt window, enter

telnet <address> <port_number>

The <address> syntax is the domain or the IP address of the host, while <port_number> is the port number you want to ping.

Ping a port using telnet on Windows

The output lets you know if the port is open and reachable. Alternatively, a connection failure message is shown.

Note: Learn more about Telnet by referring to our guide How To Use Telnet On Windows.

Ping a Port Using PowerShell

PowerShell is a text-based shell that comes with Windows by default.

To ping a port using PowerShell, follow these steps:

1. Search for “PowerShell” in the start menu. Click the Windows PowerShell app.

2. In the PowerShell prompt window enter

Test-NetConnection <address> -p <port_number>
Ping a port using PowerShell on Windows

If the port is open and the connection passes, the TCP test is successful. Otherwise, a warning message appears saying the TCP connection failed.


Now you know how to ping and check if a port is open by using several network tools and utilities on Linux and Windows.

Bear in mind that you should not do TCP probing or scan a system unless you have the owner’s permission. Otherwise your actions may be interpreted as an attempt to compromise security.

Was this article helpful?
Bosko Marijan
Having worked as an educator and content writer, combined with his lifelong passion for all things high-tech, Bosko strives to simplify intricate concepts and make them user-friendly. That has led him to technical writing at PhoenixNAP, where he continues his mission of spreading knowledge.
Next you should read
How to Install and Use Nmap Network Scanner on Linux
April 8, 2024

Learn how to install Nmap on a Linux based system and use it to retrieve valuable information from remote...
Read more
Nmap Commands - 17 Basic Commands for Linux Network
May 14, 2019

Nmap stands for Network Mapper. It is an open source tool for network exploration and security auditing. With...
Read more
Best Tools to Monitor Network Bandwidth on a Linux Server
May 4, 2019

There are many different tools for monitoring network traffic on a Linux server. Each option has its...
Read more
Linux Ping Command Tutorial with Examples
April 2, 2024

Most Linux users are familiar with the ping command and know how to use it in its basic form. However, there...
Read more