Consultor Eletrônico



Kbase P129634: How to find out what process is holding onto a port.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/17/2008
Status: Unverified

GOAL:

How to find out what process is holding onto a port.

GOAL:

What command will show me which process has a specific port in use.

GOAL:

What command will show me which process has a specific port in use on Linux.

GOAL:

What command will show me which process has a specific port in use on Unix.

GOAL:

What command will show me which process has a specific port in use on Windows.

FACT(s) (Environment):

UNIX
Windows
Progress 9.x
OpenEdge 10.x

FIX:

On Linux, use the netstat -nalp | grep <port#> to isolate the executable name and pid of a process that is holding onto a port. The following
example shows the output from this command.
proenv>netstat -napl | grep 20997
tcp 0 0 :::20997 :::* LISTEN 23448/java
tcp 0 0 ::ffff:172.16.12.30:49914 ::ffff:172.16.12.30:20997 TIME_WAIT -
Use ps -ef | grep <pid> to identify the location from which this PID is being run.
The -lnp is not available with older versions of nestat on Linux.
On other UNIX Boxes, use lsof -i : <port#>. The following example shows the output:
proenv> lsof -i :5566
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
_mprosrv 925838 root 24u IPv4 0xf100020000440398 0t0 TCP *:is-presa
Use ps -ef | grep <pid> to identify the location from which this PID is being run.
On Windows, use the netstat -nab command. The following example shows the output from this command:
proenv>netstat -nab
TCP 0.0.0.0:8888 0.0.0.0:0 LISTENING 7172
[_mprosrv.exe]