Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

5 Answers

up vote 13 down vote accepted
% 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
share|improve this answer
add comment
ps auxwwwe

Source:

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

share|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
add comment

One way is ps -ef

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

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.

share|improve this answer
add comment
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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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