Date: 2019sep20
Update: 2025jun30
Product: nmap
Keywords: port scan, ports
Q. nmap: check if a TCP port is open/filtered/closed/etc
A. Use `nmap`. Here we are just scanning port 80 on the local machine:
nmap localhost -p 80
Example output:
Starting Nmap 7.92 ( https://nmap.org ) at 2025-06-30 12:05 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000072s latency).
Other addresses for localhost (not scanned): ::1
PORT STATE SERVICE
80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds
In the STATE column it will report this states:
open
closed
filtered
unfiltered
open|filtered
closed|filtered
For more info
https://nmap.org/book/man-port-scanning-basics.html