How to Ping a Specific Port in Windows and Linux

In this post, we will discuss how you can use various tools to send a ping request to check if a target port on a specific host is alive.

How to Ping a Specific Port in Windows and Linux

Ping is one of the most fundamental tools when it comes to network troubleshooting. It allows you to quickly test whether a given service/port is responding or not. Due the lightweight nature of ICMP packets, it allows ping to quickly fetch useful information about a given system without sending a series of packets that would otherwise overwhelm the host (in some cases).

Although pinging an entire host can be useful for checking if a given host is up, it does not offer much information about if a target port is up.

Method 1 - Use Telnet

You are probably familiar with telnet. Also known as Terminal or Network, Telnet is a command-line utility that allows you perform interactive network communication using the TELNET protocol.

An telnet tutorial is coming up soo. Stay tuned for that.

To ping a specific port using telnet, use the command syntax as:

telnet [ip_address] [port_number]

The telnet command is available in both Windows and Unix systems. However, you may need to enable Telnet in Windows.

To learn how do that, check the link below:

On macOS, use brew to install Telnet:

brew install telnet

On Debian and Debian-Based distributions, install telnet:

sudo apt-get install telnet

The example below shows how to use telnet to check if Nginx Server is running.

telnet 80

If the service is running, telnet will connect and return an output as:

Connected to
Escape character is '^]'.

To close the connection, press CTRL + C]

Method 2 - Using Nmap

Nmap is another 'crazy' networking tool that every sys admin and security researcher should use. We will be putting out nmap tutorials in a near future. Make sure to subscribe to get notified when we do.

Start by installing nmap:

sudo apt-get install nmap

On macOS:

brew install nmap


sudo yum install nmap

Once installed, check if a port is up by running the command:

nmap -p <port> [target_address]


sudo nmap -p 80

Nmap will return detailed information including the latency, port number, associated service and its state. An exmaple output is as shown:

Starting Nmap 7.93 ( ) at 2022-10-02 10:49 EAT
Nmap scan report for
Host is up (0.28s latency).

80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 0.65 seconds

Method 3 - Using Netcat

Netcat is another tool you can use to check if a port is up. Check the nectat cheat sheet to learn more.

To ping a port using netcat, run the command:

nc -vz [target_address] [port_number]


sudo nc -zv 80
Connection to port 80 [tcp/http] succeeded!

We can see that the connection to the target address and port is successful. This indicates the port/service is up.

Method 3 - Using cURL

We obviously cannot forget to mention cURL in this list. The command syntax is as shown:

curl -s [host:port]


curl -s >/dev/null && echo Connected. || echo Failed.

The command should "Connected" if the port/service is up.

Method 4 - Using Windows PowerShell

In Windows, you can use the Test-NetConnection cmdlet to test if a port is up and running. The command syntax is as shown:

Test-NetConnection [ip_address] -p [port_number]


Test-NetConnection -p 80

The command should return details about the target host and the connection status.

ComputerName     :
RemoteAddress    :
RemotePort       : 80
InterfaceAlias   : Ethernet
SourceAddress    :
TcpTestSucceeded : True

Method 5 - Using PsPing Utility

In Windows, you can also use the PsPing utility which is part of Windows SysInternals tools. Download the tool in the resource below:

You can then use the command synax below to ping a specific port:

psping [address:port]



The command should send ping request to the target address and port and return the output as shown:

PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utility
Copyright (C) 2012-2016 Mark Russinovich
Sysinternals -

TCP connect to
5 iterations (warmup 1) ping test:
Connecting to (warmup): from 239.30ms
Connecting to from 239.56ms
Connecting to from 239.36ms
Connecting to from 237.90ms
Connecting to from 237.86ms

TCP connect statistics for
  Sent = 4, Received = 4, Lost = 0 (0% loss),
  Minimum = 237.86ms, Maximum = 239.56ms, Average = 238.67ms

The above port is up.


In this post, we explored various methods and tools you can use to ping a specific port in both Windows and Unix based systems.

Thanks for reading and catch you in the next one!!

If you enjoy our content, please consider buying us a coffee to support our work:

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.