If i have a process PID X, how can I find out what directory it was running in? I can see with
ps aux | grep X the full command line that it was invoked with. However in this case it's
./script.sh, and I want to see which
script.sh it's running.
The problem with
This will show what the $PWD was at the time the script was started (substitute the process ID you're interested in where you see "PID"):
This will show the command that started it so you can see if a relative or absolute directory was used:
Together, these should show you which script is being run. For one started with