How can I know the absolute path of a running process?

% 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

Use:

pwdx $pid

This gives you the current working directory of the pid, not its absolute path.

Usually the which command will tell you which is being invoked from the shell:

#> which vlc
/usr/bin/vlc

One way is ps -ef

Tags:

Linux

Process

Ps