标签:linux命令基础
命令功能:显示登录用户的信息
命令格式:
常用选项:
举例:
w 显示已经登录的用户及正在进行的操作
[root@localhost ~]# w
11:22:01 up 4 days, 21:22, 3 users, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty1 - Thu14 4days 0.19s 0.19s -bash
root pts/0 172.31.3.32 Thu14 0.00s 0.73s 0.00s w
root pts/1 172.31.3.32 11:18 1:50 0.07s 0.02s -bash
who 显示已经登录的用户名、终端名称、登录时间及登录IP
[root@localhost ~]# who
root tty1 2015-11-12 14:00
root pts/0 2015-11-12 14:03 (172.31.3.32)
root pts/1 2015-11-17 11:18 (172.31.3.32)
whoami 显示当前用户的用户名
[zzd@localhost ~]$ whoami
zzd
who am i 显示登录系统的时候的用户名,即使已经切换到其他用户也显示登录时的用户
结果同who -m
[zzd@localhost ~]$ whoami
zzd
[zzd@localhost ~]$ who am i
root pts/1 2015-11-17 11:18 (172.31.3.32)
[zzd@localhost ~]$ who -m
root pts/1 2015-11-17 11:18 (172.31.3.32)
标签:linux命令基础
原文地址:http://wszzdanm.blog.51cto.com/1841747/1713402