欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

linux中的last命令

shiping1 的头像
last 命令:

功能说明:列出目前与过去登入系统的用户相关信息。

========测试环境: Fedora Core 6.0;内核:2.6.18========
#last用了显示用户登录情况。以下是直接显示固定行数的记录。kkk是新建的用户。
[kkk@localhost ~]$ last -6
kkk     pts/2        :0.0             Thu Jul 26 20:48   still logged in  
kkk     pts/2        :0.0             Thu Jul 26 20:21 - 20:21 (00:00)   
kkk     :0                            Thu Jul 26 20:21   still logged in  
reboot   system boot 2.6.18-1.2798.fc Thu Jul 26 20:20          (00:41)   
kkk     pts/2        :0.0             Thu Jul 26 11:16 - 11:46 (00:30)   
kkk     pts/2        :0.0             Thu Jul 26 10:18 - 10:18 (00:00)   

wtmp begins Sun Jul 1 15:17:08 2007

#默认是显示wtmp的记录,btmp能显示的更详细,可以显示远程登录,例如ssh登录。
[root@localhost ~]# last -n 15 -f /var/log/btmp
kkk     :0                            Thu Jul 26 20:21   still logged in  
klot     tty1                          Fri Jul 20 22:27    gone - no logout
np962e76 tty1                          Fri Jul 20 22:26 - 22:27 (00:00)   
klot     tty1  

普通分类: