Pages

Monday, September 3, 2012

Working Directory of a Current Process


There are many times for a sys admin or even a developer to get the current working directory of a process. We can get this information by visiting /proc/pid/cwd or even by using pwdx command.

According to the man pages, a pwdx command provides the information of the working directory of a process.

If we need to find the current working directory of a process 3349, we can use

[root@vx111a local]# pwdx 3349
3349: /root

Or We can also use

 [root@vx111a local]# cat /proc/$(lsof -ti:3349)/cmdline
ro root=LABEL=/ rhgb quiet

Happy learning