Linux – How to know the absolute path of a running process

linuxprocessps

If I have multiple copies of the same application on the disk, and only one is running, as I can see with ps, how can I know the absolute path to distinguish it from the others?

Best Answer

% 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