---
title: "Linux通过网络端口（或者PID）查找运行程序路径"
author: "heipark"
date: "2015-05-07T16:47:43Z"
tags: []
categories: ["操作系统"]
slug: "linux-pid"
draft: false
lastmod: "2015-05-07T16:47:57Z"
id: 2209196
url: "https://heipark.iteye.com/blog/2209196"
---

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 -&gt; /apsarapangu/disk1/yuezi/apps/tengine-2.1.0/sbin

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

 

这里可以看到程序路径了

 

--end