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

7

4

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?

Sourabh

Posted 2011-03-16T09:57:04.530

Reputation: 173

Question was closed 2012-08-30T20:38:20.357

Answers

12

as root

sudo lsof -i
sudo netstat -lptu

Mohammad Efazati

Posted 2011-03-16T09:57:04.530

Reputation: 296

2I generally do: "sudo netstat -anp | grep port_number" – Cyber Oliveira – 2011-03-16T19:20:14.420

2i like netstat -tnlp – vahid chakoshy – 2012-10-26T11:59:19.700

6

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).

alienhard

Posted 2011-03-16T09:57:04.530

Reputation:

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

Brandon

Posted 2011-03-16T09:57:04.530

Reputation:

0

You can use netstat to list all processes listening on some port. But I don't how to filter for a specific one.

krtek

Posted 2011-03-16T09:57:04.530

Reputation: 186

0

netstat should help if you are on Linux. For more information see man netstat.

Srisa

Posted 2011-03-16T09:57:04.530

Reputation: