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

link|improve this question

feedback

4 Answers

up vote 3 down vote accepted
% sudo ls -l /proc/PID/exe

eg:

% ps auxwwwe | 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
link|improve this answer
feedback

One way is ps -ef

link|improve this answer
didn't work for a specific service, it just provide the relative path – Jader Dias Feb 1 '10 at 16:57
feedback

The quick answer is to use ps with options or the /proc filesystem info. That will usually work, but is not guaranteed. In general, there is no definite, guaranteed answer. For instance, what if the executing file is deleted during execution, so that there is no path to the file?

See the Unix FAQ for a little more detail, particularly questions 4.3 and 4.4.

link|improve this answer
feedback
ps auxwwwe

Source:

http://serverfault.com/questions/62322/getting-full-path-of-executables-in-ps-auxwww-output

link|improve this answer
does not show ALL full qualified paths on my linux: "root 24466 0.0 0.0 1476 280 ? S 2009 0:00 supervise sshd " for example – akira Feb 1 '10 at 17:04
feedback

Your Answer

 
or
required, but never shown

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