How can I see what ports are open on my machine?

I've always used this:

sudo netstat -ntlp | grep LISTEN

If the netstat command is not available, install it with:

sudo apt install net-tools

nmap (install)

Nmap ("Network Mapper") is a free and open source utility for network exploration or security auditing.

Use nmap 192.168.1.33 for internal PC or nmap external IP address.

More information man nmap.

Zenmap is the official GUI frontend.


Other good ways to find out what ports are listenting and what your firewall rules are:

  • sudo netstat -tulpn

  • sudo ufw status