LINUX last命令
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 Fri
Jul 20 22:26 - 22:26
(00:00)
root
:0 Fri
Jul 20 22:22 - 20:21
(5+21:58)
klot
:0 Fri
Jul 20 22:22 - 22:22
(00:00)
root
tty1 Fri
Jul 20 20:58 - 22:26
(01:28)
klot
tty1 Fri
Jul 20 20:58 - 20:58
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:58
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:57
(00:00)
reboot
tty1 Fri
Jul 20 20:55 - 20:57
(00:02)
root
tty1 Fri
Jul 20 20:54 - 20:55
(00:00)
root
tty1 Fri
Jul 20 20:54 - 20:54 (00:00)
btmp begins Mon Apr 30 22:05:54 2007
显示特定tty口的登录,1是tty1的登录情况,看的很清楚的。 np962e76 和 lkdjflkj
和klot其实都没有登录成功,我是把密码忘记了。前面两个用户,是根本不存在的,但是也有记录。
[root@localhost ~]# last -n 15 -f /var/log/btmp 1
klot
tty1 Fri
Jul 20
22:27 gone
- no logout
np962e76
tty1 Fri
Jul 20 22:26 - 22:27
(00:00)
klot
tty1 Fri
Jul 20 22:26 - 22:26
(00:00)
root
tty1 Fri
Jul 20 20:58 - 22:26
(01:28)
klot
tty1 Fri
Jul 20 20:58 - 20:58
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:58
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:57
(00:00)
reboot
tty1 Fri
Jul 20 20:55 - 20:57
(00:02)
root
tty1 Fri
Jul 20 20:54 - 20:55
(00:00)
root
tty1 Fri
Jul 20 20:54 - 20:54
(00:00)
root
tty1 Fri
Jul 20 20:54 - 20:54
(00:00)
lkdjflkj
tty1 Fri
Jul 20 20:54 - 20:54
(00:00)
klot
tty1 Fri
Jul 20 20:53 - 20:54
(00:00)
btmp begins Mon Apr 30 22:05:54 2007
显示特定用户的登录情况。
[root@localhost ~]# last -n 15 -f /var/log/btmp klot
klot
tty1 Fri
Jul 20
22:27 gone
- no logout
klot
tty1 Fri
Jul 20 22:26 - 22:26
(00:00)
klot
:0 Fri
Jul 20 22:22 - 22:22
(00:00)
klot
tty1 Fri
Jul 20 20:58 - 20:58
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:58
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1 Fri
Jul 20 20:53 - 20:54
(00:00)
klot
tty1 Fri
Jul 20 20:53 - 20:53
(00:00)
klot
tty1 Fri
Jul 20 20:53 - 20:53
(00:00)
klot
tty1 Fri
Jul 20 20:53 - 20:53
(00:00)
klot
tty1 Fri
Jul 20 20:52 - 20:53
(00:00)
klot
tty1 Fri
Jul 20 20:52 - 20:52
(00:00)
klot
tty1 Fri
Jul 20 20:52 - 20:52
(00:00)
btmp begins Mon Apr 30 22:05:54 2007
显示登录登出的记录,-x。
[root@localhost ~]# last -n 15 -f /var/log/btmp klot -x
klot
tty1 Fri
Jul 20
22:27 gone
- no logout
klot
tty1 Fri
Jul 20 22:26 - 22:26
(00:00)
klot
:0 Fri
Jul 20 22:22 - 22:22
(00:00)
klot
tty1 Fri
Jul 20 20:58 - 20:58
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:58
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1 Fri
Jul 20 20:53 - 20:54
(00:00)
klot
tty1 Fri
Jul 20 20:53 - 20:53
(00:00)
klot
tty1 Fri
Jul 20 20:53 - 20:53
(00:00)
klot
tty1 Fri
Jul 20 20:53 - 20:53
(00:00)
klot
tty1 Fri
Jul 20 20:52 - 20:53
(00:00)
klot
tty1 Fri
Jul 20 20:52 - 20:52
(00:00)
klot
tty1 Fri
Jul 20 20:52 - 20:52
(00:00)
btmp begins Mon Apr 30 22:05:54 2007
-i显示特定ip登录的情况。跟踪用。
[root@localhost ~]# last -n 15 -i 127.0.0.1 -f /var/log/btmp
klot
klot
tty1
0.0.0.0 Fri
Jul 20
22:27 gone
- no logout
klot
tty1
0.0.0.0 Fri
Jul 20 22:26 - 22:26
(00:00)
klot
:0
0.0.0.0 Fri
Jul 20 22:22 - 22:22
(00:00)
klot
tty1
0.0.0.0 Fri
Jul 20 20:58 - 20:58
(00:00)
klot
tty1
0.0.0.0 Fri
Jul 20 20:57 - 20:58
(00:00)
klot
tty1
0.0.0.0 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1
0.0.0.0 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1
0.0.0.0 Fri
Jul 20 20:57 - 20:57
(00:00)
klot
tty1
0.0.0.0 Fri
Jul 20 20:53 - 20:54
(00:00)
klot
tty1
0.0.0.0 Fri
Jul 20 20:53 - 20:53
(00:00)
klot
tty1
0.0.0.0 Fri
Jul 20 20:53 - 20:53
(00:00)
klot
tty1
0.0.0.0 Fri
Jul 20 20:53 - 20:53
(00:00)
klot
tty1
0.0.0.0 Fri
Jul 20 20:52 - 20:53
(00:00)
klot
tty1
0.0.0.0 Fri
Jul 20 20:52 - 20:52
(00:00)
klot
tty1
0.0.0.0 Fri
Jul 20 20:52 - 20:52
(00:00)
btmp begins Mon Apr 30 22:05:54 2007
浙公网安备 33010602011771号