2016年2月29日 星期一

[Linux 常見問題] How do I get the path of a process in Unix / Linux

Source From Here
Question
In Windows environment there is an API to obtain the path which is running a process. Is there something similar in Unix / Linux? Or is there some other way to do that in these environments?

How-To
If you want the path of the current executable, look at /proc/$PID/exe, which is a symlink to it. For example:
# ./a.out & // Sleep 10 second
[1] 22383
# ls -hl /proc/22383/exe
lrwxrwxrwx. 1 root root 0 3月 1 11:07 /proc/22383/exe -> /root/PhishTankWH/a.out


沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...