0

in directory a I ran a Python process named basic.py and then I ran another Python process in directory b named basic.py too. And I want to kill the process ran in directory b, however when I used ps -ef | grep basic.py, I couldn't tell which one to kill?

$ ps -ef | grep basic
doom     38218     1 99 Jul15 ?        2-17:27:30 python3 basic.py
doom     39222     1 99 Jul15 ?        5-14:21:03 python3 basic.py

How can I get the directory and kill that process?

0

1 Answer 1

0

this super user answer by akira

% sudo ls -l /proc/PID/exe

eg:

% ps -auxwe | grep 24466
root     24466  0.0  0.0   1476   280 ?        S     2009   0:00 supervise sshd
% sudo ls -l /proc/24466/exe
lrwxrwxrwx 1 root root 0 Feb  1 18:05 /proc/24466/exe -> /package/admin/daemontools-0.76/command/supervise

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .