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/