Linux – Get full path of a running process

|
| By Webner

2 ways that I know to get the full path of a process in linux:

1. /proc/ /exe is a symlink to the actual exe. Here’s what I get for a program eclipse running on my machine under pid 4825 with this command:

localhost:/home/Office # ls -la /proc/4825/exe

lrwxrwxrwx 1 Office users 0 May 15 11:30 /proc/4825/exe -> /opt/eclipse/eclipse

2. with ps command we can get the full path:

localhost:/home/Office # ps -u -p 4825

Warning: bad ps syntax, perhaps a bogus ‘-‘? See http://procps.sf.net/faq.html

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

Office 4825 0.0 0.1 81452 2872 ? S 11:07 0:00 /opt/eclipse/eclipse

localhost:/home/Office # ps agx | grep 4825

4825 ? S 0:00 /opt/eclipse/eclipse

Leave a Reply

Your email address will not be published. Required fields are marked *