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.
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
To get a list of all the folders a given user $USER
is in, you can query all processes (assuming sufficient permissions, e.g. as root) and remove duplicate folders (usually there are many duplicates):
for I in `ps -u $USER -o pid --no-headers` ; do readlink -f /proc/$I/cwd ; done | sort | uniq