linux查看用户相关信息的命令

1.查看用户信息的命令:id 参数 用户名

参数
-g	显示用户所属群组的ID
-u	显示用户ID
-G	显示用户所属附加群组的ID

执行id命令不加用户名,默认输出当前用户的ID信息

查看linzef用户的信息:

[root@master ~]# id linzef
uid=1000(linzef) gid=1000(oinstall) groups=1000(oinstall),1001(dba)

2.查看用户所在组的命令:groups 参数 用户名

查看linzef用户所在的组:

[root@master ~]# groups linzef
linzef : oinstall dba

3.查看当前登录用户命令:whoami

[root@master ~]# whoami
root
[root@master ~]# who am i
root     pts/0        2023-11-07 17:42 (192.168.16.1)

4.查看当前用户命令w

[root@master ~]# w
 18:11:51 up 31 min,  1 user,  load average: 0.00, 0.01, 0.01
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0     17:42    7.00s  0.00s  0.00s w

5.查看登录用户命令:who

6.查看登录历史用户命令:last

[root@master ~]# last
root     pts/0        192.168.16.1     Tue Nov  7 17:42   still logged in   
reboot   system boot  3.10.0-123.el7.x Tue Nov  7 17:40 - 18:14  (00:34)    
root     pts/0        192.168.16.1     Thu Oct 19 18:54 - crash (18+22:45)  
reboot   system boot  3.10.0-123.el7.x Thu Oct 19 18:54 - 18:14 (18+23:20)  
root     pts/0        192.168.16.1     Thu Oct 12 22:19 - crash (6+20:34)   
root     pts/0        192.168.16.1     Thu Oct 12 19:05 - 21:51  (02:46)    
reboot   system boot  3.10.0-123.el7.x Thu Oct 12 19:04 - 18:14 (25+23:10)  
root     pts/0        192.168.16.1     Mon Oct  9 23:12 - crash (2+19:52)   
reboot   system boot  3.10.0-123.el7.x Mon Oct  9 23:12 - 18:14 (28+19:02)  
root     pts/0        192.168.16.1     Sun Oct  8 21:50 - crash (1+01:21)   
reboot   system boot  3.10.0-123.el7.x Sun Oct  8 21:49 - 18:14 (29+20:25)  
root     pts/0        192.168.16.1     Thu Aug 31 16:45 - 16:46  (00:00)    
reboot   system boot  3.10.0-123.el7.x Thu Aug 31 16:45 - 18:14 (68+01:29)  
reboot   system boot  3.10.0-123.el7.x Thu Aug 31 16:45 - 16:45  (00:00)    
root     pts/0        192.168.16.1     Wed Aug 30 17:53 - crash  (22:51)    
root     tty1                          Wed Aug 30 17:52 - crash  (22:52)    
reboot   system boot  3.10.0-123.el7.x Wed Aug 30 17:52 - 16:45  (22:53)    
root     pts/0        192.168.16.1     Wed Aug 30 17:47 - down   (00:04)    
root     pts/0        192.168.16.1     Wed Aug 30 16:40 - 17:47  (01:06)    
reboot   system boot  3.10.0-123.el7.x Wed Aug 30 16:40 - 17:51  (01:11)    
root     pts/0        192.168.16.1     Mon Aug 28 21:52 - crash (1+18:48)   
reboot   system boot  3.10.0-123.el7.x Mon Aug 28 21:47 - 17:51 (1+20:03)   
root     pts/0        192.168.16.1     Mon Jul 24 21:01 - 00:28  (03:27)    
root     pts/2        192.168.16.1     Mon Jul 24 19:47 - 20:29  (00:42)    
root     pts/1        192.168.16.1     Mon Jul 24 19:21 - 19:47  (00:25)    
root     pts/1        192.168.16.1     Mon Jul 24 18:50 - 19:20  (00:30)    
root     pts/0        192.168.16.1     Mon Jul 24 17:05 - 20:59  (03:54)    
reboot   system boot  3.10.0-123.el7.x Mon Jul 24 17:04 - 17:51 (37+00:47)  
root     pts/0        192.168.16.1     Tue Jun 13 17:05 - crash (40+23:58)  
root     pts/0        192.168.16.1     Tue Jun 13 00:11 - 17:05  (16:53)    
root     pts/0        192.168.16.1     Tue Jun 13 00:11 - 00:11  (00:00)    
root     pts/1        192.168.16.1     Tue Jun 13 00:10 - 00:11  (00:01)    
root     pts/0        192.168.16.1     Tue Jun 13 00:00 - 00:10  (00:10)    
root     tty1                          Mon Jun 12 23:51 - crash (41+17:13)  
reboot   system boot  3.10.0-123.el7.x Mon Jun 12 23:47 - 17:51 (78+18:04)  

wtmp begins Mon Jun 12 23:47:41 2023

你可能感兴趣的:(linux,ffmpeg,运维)