Find out current working directory of a running process
You are here
There are 3 methods that I'm aware of:
pwdx
$ pwdx <PID>
lsof
$ lsof -p <PID> | grep cwd
/proc
$ readlink -e /proc/<PID>/cwd
Examples
Say we have this process.
$ pgrep nautilus 12136
Then if we use pwdx:
$ pwdx 12136 12136: /home/saml
Or you can use lsof:
$ lsof -p 12136 | grep cwd nautilus 12136 saml cwd DIR 253,2 32768 10354689 /home/saml
Or you can poke directly into the /proc:
$ readlink -e /proc/12136/cwd/ /home/saml
Category: