How to see what process has a network port in use?

alina's picture

A very useful command that can help when you want to see what service uses what port, is lsof.

It comes already installed in Ubuntu 9.10. You can man it to see what you can do with it.

Here is the output for :

:~$lsof -i :9000

COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    9602 alina  189u  IPv6  38064      0t0  TCP *:9000 (LISTEN)

So there is a java process, with the pid 9602 opened by the user alina (that is me) listening on the TCP 9000 port.

No votes yet

Post new comment

The content of this field is kept private and will not be shown publicly.
 
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
1 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

About LifLife   |   Terms & Condition   |   Advertising   |   Contact      ©liflife.com