Linux/AIX/Windows端口和进程互查

经常我们需要通过端口号查是哪个进程占用,或想查看某个进程占用了哪些端口。

 

1.1Linux上通过端口查找进程

比如我们想知道当前系统中80端口是哪个进程所占用

netstat -anp|grep 80 |more    #定位进程ID

ps -ef |grep 35113    #通过进程ID定位出进程启动命令

 

1.2Linux上通过进程找端口

比如我们想查找weblogic进程监听了哪些地址(地址即IP+端口)

ps -ef |grep weblogic    #定位进程ID

netstat -anp|grep 74529  #通过进程ID定位

 

 

2.1AIX上通过端口查找进程

netstat -Aan|grep 80 #通过该命令我们可以查到监听端口的进程的PCB(Protocol Control Block)
rmsock PCB tcpcb #如果传输层使用的是tcp协议,使用此命令查找监听进程的pid
rmsock PCB inpcb #如果传输层使用的是udp协议,使用此命令查找监听进程的pid
ps -ef |grep pid #通过pid定进进程

 

 

3.1Windows上通过端口查找进程

netstat -ano| findstr 443 | findstr LISTENING
tasklist | findstr 4244

 

posted on 2017-05-19 18:22  诸子流  阅读(781)  评论(0编辑  收藏  举报