linux根据进程号查端口的2种方法

[db02@centos1 conf]$ lsof -i|grep 57081
java    57081 db02   72u  IPv4 364481      0t0  TCP *:7199 (LISTEN)
java    57081 db02   85u  IPv4 364582      0t0  TCP 10.6.6.11:9042 (LISTEN)
java    57081 db02  159u  IPv4 364576      0t0  TCP 10.6.6.11:afs3-fileserver (LISTEN)
[db02@centos1 conf]$ netstat -anp|grep 57081
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 10.6.6.11:9042          0.0.0.0:*               LISTEN      57081/java          
tcp        0      0 10.6.6.11:7000          0.0.0.0:*               LISTEN      57081/java          
tcp        0      0 0.0.0.0:7199            0.0.0.0:*               LISTEN      57081/java          
unix  2      [ ]         STREAM     CONNECTED     364573   57081/java           
unix  2      [ ]         STREAM     CONNECTED     364479   57081/java           
[db02@centos1 conf]$ 

猜你喜欢

转载自blog.csdn.net/mnbwz/article/details/113800729
今日推荐