2009年3月11日 星期三

Find which process has occupied which port

In Linux:
lsof – list open files
The syntax for using "lsof" is:
lsof -i tcp:3480
or
lsof -i udp:3480
if you are interested in port 3480, over the appropriate protocol, TCP or UDP...

In Windows:

C:\>netstat -abno

使用中連線

  協定   本機位址               外部位址               狀態            PID
  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       1932
 [httpd.exe]
  TCP    0.0.0.0:113            0.0.0.0:0              LISTENING       3580
 [ident.exe]
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       800
  RpcSs
 [svchost.exe]
  TCP    0.0.0.0:1025           0.0.0.0:0              LISTENING       472
 [wininit.exe]

In AIX:

netstat -Aa | gret 8080
rmsock xxxxxxxx tcpcb
ps -ef|grep thepid