Reputation: 2775
In my terminal, I can see a python program in execution:
python3 app.py
where can I find app.py
?
I've tried to look in the /proc/$pid/exe
but links to the python interpreter.
I have many app.py
programs in my system, I want to find out exactly which is in execution with that pid.
Upvotes: 1
Views: 1189
Reputation: 8579
If you are on Mac Os X please try using:
sudo find / -type f -fstype local -iname "app.py"
If you are not on Mac Os X you can use:
sudo find / -mount -type f -iname "app.py"
The find command will start from your root folder and search recursively for all the files called "app.py" (case insensitive).
Upvotes: 0
Reputation: 46849
i ran a short test on my machine and came up with this... maybe it helps:
find the process id PID
of the job in question:
$ ps -u $USER -o pid,cmd | grep app.py
the PID
will be in the first column. assign this number to the variable PID
.
find the current working directory of that job:
$ ls -l /proc/$PID/cwd
(for more info: cat $ cat /proc/$PID/environ
)
your app.py
file will be in this directory.
Upvotes: 3
Reputation: 2634
check the file
/proc/[PID]/environ
There is PWD variable contains full path of the directory containing the executable file.
Upvotes: 2