Finding current working dir path

Hi Folks,

In a Unix (ksh) script, is there a way to determine the current working directory path of another logged-in user? Of course, I can use "pwd" to find my own path. But, how do I find it for another active user?

Thanks for any input you can provide. LY

I'm not sure how you would do it in a script, or where exactly you could get the info from... maybe awk or grep... but you can get a user's current directory through finger.

Hope that helps... maybe someone else knows how to get it through a script for sure. :confused:

Thanks for replying ober.

"finger" appears to only provide the logged-in users home directory and not the current working directory path they're in.
But, thanks for replying anyway. LY

Any other great ideas out there?

There is a freeware program called "lsof" that can do this. Bear in mind that the user can be running several programs, each with a different current working directory. So you you will need to find a pid of a process that you're interested in. Then "lsof -p $pid" will show all files open by that process. And the current directory will have "cwd" in the FD column.

my bad... that was before my caffine jolt for the morning... what was I thinking??? :confused:

Perderabo,

Sounds great. Thanks much. I'll give it a shot.

Ober,

No problem. If I had a nickle for every "bad morning" I've had I'd be a very rich man.

Thanks all. LY:D

Perderabo,

Thanks much. Sounds like that will work great. I'll give it a shot.

Ober5861

If I had a nickel for every "bad morning" I've had, I'd be a very wealthy guy.

Thanks all. LY