Directory process was started from ?

Dirk Moolman DirkM
Fri Jan 5 09:00:39 PST 2007


-----Original Message-----
From: linux-users-bounces at linux-sxs.org
[mailto:linux-users-bounces at linux-sxs.org] On Behalf Of Brad De Vries
Sent: 04 January 2007 11:02 PM
To: Linux tips and tricks
Subject: Re: Directory process was started from ?

On 1/4/07, Dirk Moolman <DirkM at agilitytech.co.za> wrote:
> Hi, I have an interesting question (err, well, for me at least)
>
> Is there a way I can see which directory a process was started from ?
> Let's say I have an app, but in directory1 and also in directory2, and
I
> start the app from one of them.
>
> Is there a way to see in the process list (ps) which directory it was
> started from ?
>
>
> Dirk
>
>



>Dirk, you could try looking in the /proc filesystem.  If you find the
>process ID of the process you're interested in, you can check:
>   /proc/<pid>/cwd
>
>It should be a symlink to the current working directory of the process.


Excellent, tried this one too - works great.   My immediate thought was
to script this, to make finding the output faster.

Thank you very much

:-)


Disclaimer: http://196.33.167.70/disclaimer





More information about the Linux-users mailing list