Sunday, September 21, 2014

Current working directory of a process

Recently, I am dealing with a lot of automation scripts and running automation jobs. Sometimes, it is required for me to kill my jobs to give way to other processes. :(

Anyway, I need to continue my automation job after the "higher priority" processes completed. Thus, the working directory of my process is EXTREMEly important.

So, before killing the job, I have already gotten the pid. To get the working directory, use pwdx command with the pid will do.

pwdx <pid>

Example:

pwdx 1234

For further information or more ways to do this, check out this page: http://www.cyberciti.biz/tips/linux-report-current-working-directory-of-process.html