Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I tell which process is using port 8888? I have an NKE and my process is needing to connect to it. Every now and then I get bind socket error, 127.0.0.1:8888 is in use...

Any ideas?

share|improve this question
    
Are you really on MacOS? Props, man. –  Chris Lutz Jun 30 '11 at 21:55
    
Please do not cross-post on multiple sites - decide which site is best for your question, and then write the question for that site's audience. Thanks. –  nhinkle Jun 30 '11 at 22:58

2 Answers 2

@Somantra's answer is close, but won't quite work. Try:

sudo lsof -i:8888

sudo may be needed so lsof can see processes not owned by you; also, grepping lsof's output will fail unless you search for the service name associated with port 8888 (it's "ddi-tcp-1").

share|improve this answer
    
great now that I know what process is owning that, can I just kill it so that application can use that port to communicate with my NKE? Will ddi-tcp-1 just pick another port to use? and why do i only run into this problem on OS Mac 1.0.5? –  reza Jul 5 '11 at 15:14
    
It depends on what process is using the port, and how that process is managed -- if it's something controlled by launchd, it's probably configured to relaunch if it exits for any reason. What's the process using it? Here is an example of tracking down where a launchd item is being controlled and shutting it down. –  Gordon Davisson Jul 5 '11 at 20:12

This is probably what you are looking for.

lsof | grep ":8888"

NOTE: Thanks @Gordon Davisson, I forgot about the alias I added which made the command above work for me.

alias lsof='sudo lsof -Pni4 | grep LISTEN'
share|improve this answer

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.