Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to check status of port using NMap

📅 2017-Sep-05 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ nmap, port ⬩ 📚 Archive

NMap is a classic Swiss army knife for network operations. I recently had to check if a certain port on a LAN computer was open or not. This type of diagnostic is very easy to do with NMap.

$ sudo apt install nmap
$ nmap -p 9010 medusa

Starting Nmap 6.40 ( http://nmap.org ) at 2017-08-25 13:05 SGT
Nmap scan report for medusa (192.168.110.22)
Host is up (0.00035s latency).
PORT     STATE SERVICE
9010/tcp open  sdr

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

Turns out that the port 9010 was open.

$ nmap -p 9999 medusa

Starting Nmap 6.40 ( http://nmap.org ) at 2017-08-25 13:06 SGT
Nmap scan report for medusa (192.168.110.22)
Host is up (0.00030s latency).
PORT     STATE  SERVICE
9999/tcp closed unknown

Nmap done: 1 IP address (1 host up) scanned in 0.05 seconds
$ nmap -p 0-10 medusa

Starting Nmap 6.40 ( http://nmap.org ) at 2017-08-25 13:04 SGT
Nmap scan report for medusa (192.168.110.22)
Host is up (0.00027s latency).
PORT   STATE  SERVICE
0/tcp  closed unknown
1/tcp  closed tcpmux
2/tcp  closed compressnet
3/tcp  closed compressnet
4/tcp  closed unknown
5/tcp  closed unknown
6/tcp  closed unknown
7/tcp  closed echo
8/tcp  closed unknown
9/tcp  closed discard
10/tcp closed unknown

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

Tried with: NMap 7.01 and Ubuntu 16.04