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

I would like to see what ports are open on my machine, e.g. what ports my machine is listening on. E.g. port 80 if I have installed a web server, and so on.

Is there any command for this?


Solution 1:

I've always used this:

sudo netstat -ntlp

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

sudo apt install net-tools

Solution 2:

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.