Skip to content

Instantly share code, notes, and snippets.

@Alger23
Created August 5, 2022 07:29
Show Gist options
  • Select an option

  • Save Alger23/744e4b73a02300d6f99b7f11e8d7addf to your computer and use it in GitHub Desktop.

Select an option

Save Alger23/744e4b73a02300d6f99b7f11e8d7addf to your computer and use it in GitHub Desktop.
Ping Specific Port

How to Ping Specific Port Number in Linux and Windows

Linux

  1. telnet
  2. Netcat (nc)
  3. Network Mapper (nmap)

telnet

install

for CentOS/Fedora

yum -y install telnet

for Ubuntu

sudo apt install telnet

to ping a port

telnet <address> <port_number>

telent google.com 443

Netcat

sudo apt install netcat

nc -vz <address> <port_number>

Nmap

# For CentOS/RHEL Linux
sudo yum install nmap
# For Ubuntu or Debian Linux
sudo apt install nmap
nmap -p <port_number> <address>
nmap -p 80 google.com

nmap -p <port_range> <address>
nmap -p 88-93 google.com

Windows

  1. Telnet
  2. 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.
telnet <address> <port_number>

Ping a Port Using PowerShell

Test-NetConnection <address> -p <port_number>
Test-NetConnection google.com -p 80

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment