last 功能说明:从日志文件/var/log/wtmp 读取信息并显示用户最近的登录列表。
参数选项:
-num 或者 -n num 指定显示结果的行数。
[root@testdb62 ~]# last -n10
root     pts/2        10.10.12.98      Mon Dec 21 13:25   still logged in   
root     pts/0        10.10.12.98      Mon Dec 21 09:35   still logged in   
root     pts/0        10.10.12.98      Fri Dec 18 19:47 - 19:51  (00:04)    
root     pts/0        10.10.12.98      Fri Dec 18 09:39 - 10:45  (01:05)    
root     pts/0        10.10.12.98      Thu Dec 17 09:34 - 10:09  (00:35)    
root     pts/0        192.168.10.3     Wed Dec 16 20:25 - 21:47  (01:22)    
root     pts/0        10.10.12.98      Wed Dec 16 15:07 - 17:58  (02:51)    
root     pts/0        10.10.12.98      Wed Dec 16 14:34 - 14:35  (00:01)    
root     pts/3        10.10.12.98      Wed Dec 16 10:49 - 10:50  (00:00)    
root     pts/2        10.10.12.98      Wed Dec 16 10:49 - 13:16  (02:26)    
wtmp begins Mon Apr 13 21:24:08 2020
[root@testdb62 ~]# last -10
root     pts/2        10.10.12.98      Mon Dec 21 13:25   still logged in   
root     pts/0        10.10.12.98      Mon Dec 21 09:35   still logged in   
root     pts/0        10.10.12.98      Fri Dec 18 19:47 - 19:51  (00:04)    
root     pts/0        10.10.12.98      Fri Dec 18 09:39 - 10:45  (01:05)    
root     pts/0        10.10.12.98      Thu Dec 17 09:34 - 10:09  (00:35)    
root     pts/0        192.168.10.3     Wed Dec 16 20:25 - 21:47  (01:22)    
root     pts/0        10.10.12.98      Wed Dec 16 15:07 - 17:58  (02:51)    
root     pts/0        10.10.12.98      Wed Dec 16 14:34 - 14:35  (00:01)    
root     pts/3        10.10.12.98      Wed Dec 16 10:49 - 10:50  (00:00)    
root     pts/2        10.10.12.98      Wed Dec 16 10:49 - 13:16  (02:26)    
wtmp begins Mon Apr 13 21:24:08 2020