You can find the exe easily by these ways, just try it yourself.dom
ll /proc/<PID>/exe
socket
pwdx <PID>
tcp
lsof -p <PID> | grep cwd
spa
下面是lsof 的官方解釋:.net
lists on its standard output file information aboutcode
files opened by processes for the following UNIX dialects:orm
An open file may be a regular file, a directory, a block special file,blog
a character special file, an executing text reference, a library, a遞歸
stream or a network file (Internet socket, NFS file or UNIX domain索引
socket.) A specific file or all the files in a file system may be
selected by path.
Instead of a formatted display, lsof will produce output that can be
parsed by other programs. See the -F, option description, and the
OUTPUT FOR OTHER PROGRAMS section for more information.
參考:http://my.oschina.net/guol/blog/37304
lsof -c xxx 只顯示COMMAND列中包含xxx的
lsof -a 後面跟的兩個參數都知足時才顯示結果
lsof -u name 顯示進程屬主是name的打開的文件
lsof +d /dir/ 顯示dir目錄下被打開的文件
lsof +D /dir/ 同上,不過會遞歸下級目錄
lsof -d FD 顯示指定文件描述符的進程
lsof -i 顯示符合條件的進程狀況
-i:port
-i tcp/udp
-i hostname
FD 列內容
cwd 當前的工做目錄
txt 程序文件 code&&date
mem 內存映射文件
err FD的錯誤信息
rtd root目錄
r 只讀 w 可寫 u讀寫
xu/xr/xw x是數字 表示文件描述符是/proc/PID內容/fd/x文件
TYPE 列是相關文件的類型
DEL 一個已經被刪除的索引文件
REG 常規文件
CHR 字符設備文件
DIR 目錄
FIFO FIFO文件
LINK 符號連接文件
http://www.cyberciti.biz/faq/find-out-which-service-listening-specific-port/