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?
|
|
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 |
|||||||||
|
|
One way is ps -ef |
|||||||||
|
|
Use:
This gives you the current working directory of the pid, not its absolute path. Usually the
|
|||||||||||||
|
Source: https://serverfault.com/questions/62322/getting-full-path-of-executables-in-ps-auxwww-output |
||||
|
The quick answer is to use See the Unix FAQ for a little more detail, particularly questions 4.3 and 4.4. |
|||
|
|
|
Why does everyone expect you to know the PID? Here's the human-friendly way:
|
|||
|
You could use
or
to get the absolute path. PID is the process. |
|||
|
|
|
lsof is an option. You can try something like below: lsof -p PROCESS_ID This will list all the files opened by the process including the executable's actual location. It is then possible to add a few more awk, cut, grep etc. to find out the information that you are looking for. As an example, I executed the following commands to identify where my 'java' process came from: lsof -p 12345 | awk '{print $NF}' | grep 'java$' |
|||||
|