How do I print the current working directory of another user in linux?

为君一笑 提交于 2021-01-29 16:13:39

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/23478833/how-do-i-print-the-current-working-directory-of-another-user-in-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!