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


沒有留言:

張貼留言

[ Python 常見問題 ] python generator “send” function purpose?

Source From  Here   Question   Can someone give me an example of why the "send" function associated with Python generator function...