Is there a command line I can issue to see what directory another user is currently working in? This would be like using >pwd but for the other user.
Asked
Active
Viewed 2,295 times
0
-
2Maybe some information here may help: http://www.cyberciti.biz/tips/linux-report-current-working-directory-of-process.html – lurker May 05 '14 at 18:08
-
no one cmdline, only ways – PradyJord May 05 '14 at 18:15
-
1"Users" don't have cwds... Processes do... – twalberg May 05 '14 at 18:42
1 Answers
2
There's a cwd
symlink in every process' /proc
folder, but as a commoner you wouldn't have any rights to read any other's proc folder - only your own:
[marc@panic home]$ ls -l /proc/$$/cwd
lrwxrwxrwx. 1 marc marc 0 May 5 12:06 /proc/16257/cwd -> /home
^^^^^---cwd
[marc@panic home]$
^^^^---cwd

Marc B
- 356,200
- 43
- 426
- 500
-
-
Sure you can do the above, but you need the process id to query by. Note that "the current working directory" does not make sense in relation to a user account, but only of a process. Different processes of a user can and will have different working directories. A user account does not have a working directory. – arkascha May 05 '14 at 18:13
-
Assuming I had the following: >who jsmith console Apr 30 10:03 adam ttys000 Apr 30 10:04 bob ttys001 Apr 30 10:04 What command could I issue with this technique to see the 'cwd' of bob? – John Lewis May 05 '14 at 18:25
-
that doesn't tell you anything. you've got a username. but that shell can have MANY background tasks, and each task can have a different working directory.if you want to know what a user's terminal shell is sitting at for a directory, then you'd have to figure out what process is their shell (e.g. bash, sh, csh, etc..) and get that process' cwd. – Marc B May 05 '14 at 18:27