1

I have a program called /usr/bin/myprogram.x

In one shell window I did something like

cd /run001/
myprogram.x &
cd /run/009/
my program.x &
cd /run/234/
myprogram.x &

I kicked off a total of around 10 jobs, all under various directories, is there a way to find those run directories ?

If I do a ps -ef | grep myprogram.x it reports them all as /usr/bin/myprogram.x however I am looking for the directory each was kicked off under. Is there a way to find that?

marked as duplicate by Kusalananda linux Feb 25 at 23:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

Just find their process ids (with ps) and in /proc/<PID>/ should be a link called cwd which points to the directory where process has stared.

  • Or with pgrep, which may be safer. – Kusalananda Feb 25 at 23:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.