如何在Linux中打印另一个用户的当前工作目录? [英] How do I print the current working directory of another user in linux?

查看:86
本文介绍了如何在Linux中打印另一个用户的当前工作目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以发出命令行以查看其他用户当前正在使用哪个目录?就像使用> pwd 一样,但是对于其他用户.

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.

推荐答案

每个进程的/proc 文件夹中都有一个 cwd 符号链接,但是作为一个普通的做法,您不会无权读取任何其他人的proc文件夹-只有您自己的:

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

这篇关于如何在Linux中打印另一个用户的当前工作目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆