Directory process was started from ?

Brad De Vries devriesbj
Thu Jan 4 13:01:43 PST 2007


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
>
>
>
> Disclaimer: http://196.33.167.70/disclaimer

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.

Brad.



More information about the Linux-users mailing list