[电脑] [分享] LINUX下查看程序进程对应端口方法

隐藏内容需要回复后才能查看。

命令,会输出类似下面的行:

Active UNIX domain sockets (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:523                 0.0.0.0:*                   LISTEN      4275/db2dasrrm      
tcp        0      0 0.0.0.0:812                 0.0.0.0:*                   LISTEN      2750/rpc.statd      
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      2730/portmap        
tcp        0      0 0.0.0.0:50000               0.0.0.0:*                   LISTEN      3091/db2tcpcm 0     
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      2884/cupsd          
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      3103/sendmail: acce 
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN      3814/1              
tcp        0      0 192.168.1.161:50000         192.168.1.161:34663         ESTABLISHED 9757/db2agent (JKGL 
tcp        0      0 192.168.1.161:50000         192.168.1.161:36871         ESTABLISHED 4457/db2agent (JKGL 
tcp        0      0 :::9444                     :::*                        LISTEN      5140/java  

其中上面红色的为进程号,由进程号可推知是程序在使用的端口,如果想知道是什么程序,可使用下命令:

ps -ef|grep PID
 



2022-09-24 17:43:11 查看数:710     回复数:2 显示全部楼层
社区游客