View the running path of a process in linux
In linux, you may think of ps-ef | grep XXX.
But what we see is not the full path. How can we see the full path?
After each process is started, there is a pid path under/proc.
Example: ps-ef | grep python
Display: oracle 4431 4366 0 00:00:00 pts/2 python Server. py
4431 is the process number
To/proc/4431, ls-l will see (requires root permission ):
Total usage 0
-R -- 1 oracle oinstall 0 December 29 18:58 offline line
Lrwxrwxrwx 1 oracle oinstall 0 December 29 18:58 cwd->/XXX/ultserver_aa
-R -------- 1 oracle oinstall 0 December 29 18:58 environ
Lrwxrwxrwx 1 oracle oinstall 0 December 29 18:58 exe->/usr/bin/python2.4
Dr-x ------ 2 oracle oinstall 0 December 29 18:58 fd
-R -------- 1 oracle oinstall 0 December 29 18:58 maps
-Rw ------- 1 oracle oinstall 0 December 29 18:58 mem
-R -- 1 oracle oinstall 0 December 29 18:58 mounts
Lrwxrwxrwx 1 oracle oinstall 0 December 29 18:58 root->/
-R -- 1 oracle oinstall 0 December 29 18:58 stat
-R -- 1 oracle oinstall 0 December 29 18:58 statm
-R -- 1 oracle oinstall 0 December 29 18:58 status
Note that cwd is the path of the process to be searched.