Linux通过网络端口(或者PID)查找运行程序路径

nginx运行在38989端口

1. netstat -anp | grep 38989   

(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 0.0.0.0:38989               0.0.0.0:*                   LISTEN      81287/nginx -s start

程序PID为: 81287

2. 查看/proc

ll /proc/81287

lrwxrwxrwx 1 admin admin 0 May  6 15:51 cwd -> /apsarapangu/disk1/yuezi/apps/tengine-2.1.0/sbin

lrwxrwxrwx 1 admin admin 0 May  6 15:51 exe -> /apsarapangu/disk1/yuezi/apps/tengine-2.1.0/sbin/nginx

这里可以看到程序路径了

--end

猜你喜欢

转载自heipark.iteye.com/blog/2209196