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 trying to run weblogic server on my linux machine and I am getting the following error :

ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)

I think that the error means that the debugger port which by default is 8453 is already held by some other service . How can I find out what service is runnning in a partcular port number ?

P.S: I used netstat command but that shows all the services occupying all ports ..here I am interested in a particular port only.

share|improve this question
    
And you don't want to use grep because of? –  scai Jan 23 '13 at 9:18
    
@scai I am new to Linux world. I can ofcourse use the grep command but wanted to find out if there could be a easier way than doing a grep on the output of netstat –  Geek Jan 23 '13 at 9:52

4 Answers 4

Two ways:

  • lsof -i :port -S
  • netstat -a | grep port

You can do man lsof or man netstat for the needed info. Replace port by the port number you want to search for.

share|improve this answer
    
You may want to make that netstat -a | grep portnumber. Otherwise you will be at the mercy of /etc/services. –  Michael Kjörling Jan 23 '13 at 9:42
    
Thanks for the observation, just edited the answer. –  BitsOfNix Jan 23 '13 at 9:56

You can use fuser or lsof i.e:

fuser 8453/tcp
lsof -i TCP:8453

If you want more information from fuser you can also use the -v flag, i.e: fuser -v 8453/tcp

share|improve this answer
    
I ca not issue either command . I can see the man pages but when I issued the command I get a "lsof: Command not found.". Similar case with fuser also . –  Geek Jan 23 '13 at 10:50
    
@Geek you may have to either install the packages or specify the full path depending on your setup. –  Ulrich Dangel Jan 23 '13 at 11:48
    
I have no option of installing anything on this machine . Which full path are you talking about ? How can I see it ? Can you please put that information in the answer itself ? –  Geek Jan 23 '13 at 15:21
    
At least lsof is commonly only easily available to the system administrator, by virtue of being placed in one of the sbin directories. Try sudo -i followed by the lsof command, and see if that works better. –  Michael Kjörling Jan 23 '13 at 15:32
    
Neither lsof nor fuser are installed by default in Fedora. –  vonbrand Jan 26 '13 at 7:09

On centos

/usr/sbin/lsof -i tcp:8453 (lsof -i protocol:port)

On ubuntu

/usr/bin/lsof -i tcp:8453

Or, narrow results of netstat using filters.

share|improve this answer

for what its worth... depending on the version of netstat (specifically GNU netstat) you have, you can use

netstat -punta | grep <port>

this will show you connections in ESTABLISHED and LISTEN states UDP and TCP and it will ignore the UNIX local sockets. the end result is a nice, neat, small result set.

the -p flag will give you the process ID and the process name of whatever is using that port

the -u flag shows udp

the -n flag is for numerical addresses

the -t flag shows tcp

the -a shows listening and non-listening sockets

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.