参考:Linux w Command Tutorial for Beginners (5 Examples)
Linux who Command Tutorial for Beginners (8 Examples)
Difference between who and whoami commands
w
Show who is logged on and what they are doing.
w无参数时的输出就已经包含足够多信息,参数只是限制输出某些信息。
w user_name 显示具体某人的信息
-h:Don't print the header.
-s(小写):Use the short format. Don't print the login time, JCPU or PCPU times.
-f:Toggle printing the from (remote hostname) field
who
show who is logged on
-b:time of last system boot
-d:print dead processes
-p(小写):print active processes spawned by init
-q:all login names and number of users logged on
-r:print current runlevel
参数 | 说明 |
---|---|
-a |
打印能打印的全部 |
-d |
打印死掉的进程 |
-m |
同am i ,mom likes |
-q |
打印当前登录用户数及用户名 |
-u |
打印当前登录用户登录信息 |
-r |
打印运行等级 |
whoami
这个命令没有参数,见名知意
直接执行whoami
也可以分开写
who am i