Linux – Get full path of a running process

Author - Webner
24.01.2015
|
0 Comments
|

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

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

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