How can I find out which process is listening on a port on linux? [duplicate]

Possible Duplicate:
Finding the process that is using a certain port in Linux

How can I find out which process is listening on a port on linux?


Solution 1:

as root

sudo lsof -i
sudo netstat -lptu

Solution 2:

With lsof -iTCP -sTCP:LISTEN you get a list of all TCP ports in state LISTEN and their associated processes (command and pid are in the first two columns).

Solution 3:

you can use "netstat"

netstat -anp | less

will show you the PID and process name as the last column, checkout "man netstat" if you want to change the options