Linux – How to list the open ports on Debian

debianlinuxnetworking

What is the command to display a list of open ports on a Debian server?

I tried netstat -a | egrep 'Proto|LISTEN' but I would like something more specific that actually lists the port number.

Best Answer

 netstat -pln

-l will list listening ports, -p will also display the process, -n will show port numbers instead of names. Add -t to only show TCP ports.