用 w 查看已登录用户及其正在运行的命令
w 命令把 uptime 和 who 的信息合并,还多出每个用户“正在运行什么”的列,适合多用户服务器。
运行 `w` 即可列出所有已登录用户,包括登录时间、空闲时间和当前正在执行的前台命令。
01命令
命令
$ w02作用说明
很多人知道 who,却忘了功能更强的 w:表头重复显示运行时间和负载,每行则列出 USER、TTY、登录时间、IDLE 以及显示当前进程的 WHAT 列。用 `w -h` 可去掉表头,`w 用户名` 可只看某个账号。重启共享服务器前用它确认没有人在执行命令非常方便。
03风险
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- w(1) - show who is logged on and what they are doing依据: w displays information about the users currently on the machine, and their processes; the header shows uptime and load, and the body lists each user's current JCPU/PCPU and WHAT command.
最后验证: 2026-09-17 · 分类: 系统与设置