I'd like to be able to find out which process is currently using a certain port in Linux. Is there any way to do this?

link|improve this question

50% accept rate
1  
On Windows, the command is : netstat -anb – djangofan Dec 11 '09 at 21:39
feedback

2 Answers

up vote 20 down vote accepted

You have a couple of options:

lsof -i tcp:80

will give you the list of processes using tcp port 80.

Alternatively,

sudo netstat -nlp

will give you all open network connections.

link|improve this answer
lsof -i | grep {username} is also very useful, i.e. lsof -i | grep apache – ultrasawblade Oct 30 '11 at 3:20
feedback
netstat -lp
link|improve this answer
on mac you have to add a protocol option to -p. so something like: netstat -lp tcp. – vrish88 May 25 '10 at 14:59
On linux, -p lists the process owning the socket. – Jürgen Strobel Sep 28 '11 at 21:55
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.