Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
44
rated 0 times [  44] [ 0]  / answers: 1 / hits: 69191  / 2 Years ago, thu, june 30, 2022, 8:02:53

Is there a way to find out the directory/disk location a process was started from? I am aware of the /proc mount but not really where to look inside of it.


More From » process

 Answers
4

The /proc way would be to inspect the exe link in the directory corresponding to the pid.



Let's take an example with update-notifier:



Find the pid, which is 15421 in this example:



egil@gud:~$ ps x | grep update-notifier
2405 pts/4 S+ 0:00 grep update-notifier
15421 ? Sl 0:00 update-notifier


Look up the symbolic link:



egil@gud:~$ file /proc/15421/exe
/proc/15421/exe: symbolic link to `/usr/bin/update-notifier'

[#44601] Saturday, July 2, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
afisird

Total Points: 193
Total Questions: 112
Total Answers: 111

Location: Angola
Member since Mon, Jul 12, 2021
3 Years ago
afisird questions
Wed, Jul 27, 22, 03:53, 2 Years ago
Sun, Mar 12, 23, 18:05, 1 Year ago
Sun, Dec 11, 22, 01:19, 1 Year ago
;