Take the 2-minute tour ×
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.

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 127.0.0.1:9000          0.0.0.0:*               LISTEN

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

share|improve this question

2 Answers 2

up vote 8 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  0.0.0.0:80  0.0.0.0:*  LISTEN  125004/nginx
share|improve this answer
    
Thanks.Yes ,after I add sudo ,i get the process name:php-fpm.conf –  Vico_Wu Dec 25 '13 at 5:37

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

# lsof -i :25
COMMAND  PID        USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
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
1  
Without root, this will only be able to show you processes under your current user: sprunge.us/hgCV –  Chris Down Dec 25 '13 at 7:44

Your Answer

 
discard

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.