List all tcp ports using netstat -at
netstat -at
netstat -ltnp
-p means list all the programs run over the port
List all udp ports using netstat -au
netstat -aup
List only listening ports using netstat -l
netstat -lp
List only the listening UNIX Ports using netstat -lx
netstat -lxp
lsof command (LiSt Open Files) is used to list all open files on a Linux system. To install it on your system, type the command below.
$ sudo yum install lsof #RHEL/CentOS $ sudo apt install lsof #Debian/Ubuntu $ sudo dnf install lsof #Fedora 22+
To find the process/service listening on a particular port, type (specify the port).
$ lsof -i :80