Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am installing hadoop on my Ubuntu system. When I start it, it reports that port 9000 is busy.

I used:

netstat -nlp|grep 9000

to see if such a port exists and I got this:

   tcp        0      0*               LISTEN

But how can I get the PID of the process which is holding it?

share|improve this question
See this wilddiary.com/find-the-process-using-a-given-port – Drona Nov 1 '15 at 13:28
up vote 70 down vote accepted

You can use netstat's -p option. You're already issuing it, but to get process information, you need to be the superuser:

$ sudo netstat -nlp | grep :80
tcp  0  0*  LISTEN  125004/nginx

You can also use lsof:

$ sudo lsof -i :80 | grep LISTEN
nginx   125004 nginx    3u  IPv4   6645      0t0  TCP (LISTEN)
share|improve this answer
Note: under OSX, the -p option is for protocol rather than process. See this question – Bryan P Apr 10 at 16:51

Also you can use lsof utility. Need to be root.

# lsof -i :25
exim4   2799 Debian-exim    3u  IPv4   6645      0t0  TCP localhost:smtp (LISTEN)
exim4   2799 Debian-exim    4u  IPv6   6646      0t0  TCP localhost:smtp (LISTEN)
share|improve this answer
This command will also give you processes with established connections, not just processes that are listening. – firelynx Aug 18 '15 at 10:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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