文章目录
- 什么?谁?w (who & what)
- 默认的显示
- 不显示标题行
- 简洁模式显示
- 更多信息
什么?谁?w (who & what)
w
可以认为是加强版的who
,果然越简洁越强大,就比如less
比more
是功能更多的。
w
不仅可以显示谁在登录,还可以打印他们在做什么。w
显示的信息如下:
- 登录的用户;
- 运行的程序;
- 第一行显示的信息:当前时间、系统运行的时间、多少用户登录、系统的负载(分贝为1,5,15分钟)
官方定义为:
w - Show who is logged on and what they are doing.
用法为:
$ w [options] user [...]
常用的两个选项为:
-
-h
不显示各栏位的标题信息列。 -
-s
简洁格式列表,不显示用户登入时间,JCPU或者PCPU的时间
默认的显示
显示当前用户的登录信息及执行的命令
$ w
16:29:03 up 26 days, 2:49, 6 users, load average: 1.00, 0.97, 0.96
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
user pts/4 :1 07Sep21 20days 9:59 1:53m bash
user pts/0 :2 08Sep21 6days 0.70s 1:53m zsh
user pts/1 :3 08Sep21 20days 1:13m 1:53m bash
user :0 :0 15Sep21 6days 27days 21.36s zsh
user pts/2 :0 15Sep21 14days 0.25s 0.25s zsh
user pts/3 :3 16Sep21 24:45m 0.22s 0.22s bash
不显示标题行
$ w -h
16:29:16 up 26 days, 2:49, 6 users, load average: 1.20, 0.67, 0.76
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
user pts/4 :1 07Sep21 20days 9:59 1:53m bash
user pts/0 :2 08Sep21 6days 0.70s 1:53m zsh
user pts/1 :3 08Sep21 20days 1:13m 1:53m bash
user :0 :0 15Sep21 6days 27days 21.36s zsh
user pts/2 :0 15Sep21 14days 0.25s 0.25s zsh
user pts/3 :3 16Sep21 24:45m 0.22s 0.22s bash
简洁模式显示
$ w -s
16:29:26 up 26 days, 2:49, 6 users, load average: 1.50, 0.67, 0.36
USER TTY FROM IDLE WHAT
user pts/4 :1 20days bash
user pts/0 :2 6days zsh
user pts/1 :3 20days bash
user :0 :0 6days zsh
user pts/2 :0 14days zsh
user pts/3 :3 24:45m bash
更多信息
Hi,XDJM们,更多信息欢迎移步我的主页、CSDN或微信公众号letsProgramming.
- 🐱 github
- 🏠 Homepage https://shaoguangleo.github.io
- CSDN CSDN http://blog.csdn.net/shaoguangleo
- 微信公众号:letsProgramming