linux 下通过pid 定位该程序打开的端口

来源:互联网 发布:巨人网络薪资 编辑:程序博客网 时间:2024/03/29 07:53

首先使用ps aux 检测到耗资源的进程。

 4652 mysql     15   0  454m 124m 4752 S   58  3.1   2144:29 mysqld

 

如mysqld。

之后使用网络命令:netstat -anp 来检测该程序链接的端口:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name  
tcp        0      0 0.0.0.0:2049                0.0.0.0:*                   LISTEN      -                  
tcp        0      0 0.0.0.0:52422               0.0.0.0:*                   LISTEN      -                  
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      4652/mysqld        
tcp        0      0 0.0.0.0:3307                0.0.0.0:*                   LISTEN      5223/mysqld        

原创粉丝点击