last lastlog

lastlog显示所有用户最后登录的时间,没有登录过则显示从未登录过,如下:

[root@localhost tmp]# lastlog
Username         Port     From             Latest
root             pts/2    192.168.3.38     Mon Feb 27 18:07:59 -0800 2012
bin                                        **Never logged in**
daemon                                     **Never logged in**
adm                                        **Never logged in**
lp                                         **Never logged in**
sync                                       **Never logged in**
shutdown                                   **Never logged in**
halt                                       **Never logged in**
mail                                       **Never logged in**
uucp                                       **Never logged in**
operator                                   **Never logged in**
games                                      **Never logged in**
gopher                                     **Never logged in**
ftp                                        **Never logged in**
nobody                                     **Never logged in**
dbus                                       **Never logged in**
usbmuxd                                    **Never logged in**
avahi-autoipd                              **Never logged in**
vcsa                                       **Never logged in**
rtkit                                      **Never logged in**
abrt                                       **Never logged in**
tcpdump                                    **Never logged in**
haldaemon                                  **Never logged in**
apache                                     **Never logged in**
saslauth                                   **Never logged in**
postfix                                    **Never logged in**
avahi                                      **Never logged in**
ntp                                        **Never logged in**
sshd                                       **Never logged in**
pulse                                      **Never logged in**
gdm                                        **Never logged in**
redhat                                     **Never logged in**
mysql                                      **Never logged in**

 

last  用户名   则显示某用户所有的登录时间,如下:

[root@localhost tmp]# last root
root     pts/2        192.168.3.38     Mon Feb 27 18:07   still logged in  
root     pts/1        192.168.3.38     Mon Feb 27 00:14 - 20:06  (19:52)   
root     pts/0        192.168.3.38     Fri Feb 24 00:59 - 18:10 (3+17:11)  
root     pts/0        192.168.3.38     Thu Feb 23 23:47 - 00:57  (01:10)   
root     tty1                          Thu Feb 23 00:13   still logged in  
root     pts/0        192.168.3.38     Thu Feb  9 17:17 - 02:10 (13+08:53) 
root     pts/0        192.168.3.38     Thu Feb  9 00:43 - 02:07  (01:24)   
root     pts/1        192.168.3.38     Wed Feb  8 22:51 - crash  (01:51)   
root     pts/0        192.168.3.38     Wed Feb  8 22:34 - crash  (02:08)   
root     pts/1        192.168.3.38     Wed Feb  8 17:40 - crash  (04:40)   
root     pts/0        192.168.3.38     Wed Feb  8 00:14 - 19:39  (19:25)   
root     pts/0        192.168.3.38     Tue Feb  7 19:16 - 23:57  (04:41)   
root     tty1                          Tue Feb  7 18:55 - 23:57  (05:01)   
root     tty1                          Sun Feb  5 20:47 - crash  (00:09)   
root     pts/0        192.168.3.38     Thu Feb  2 22:31 - 02:00  (03:28)   
root     pts/0        192.168.3.38     Tue Jan 31 17:51 - crash (1+05:00)  
root     pts/1        192.168.3.38     Tue Jan 31 00:25 - 02:07  (01:42)   
root     pts/0        192.168.3.38     Mon Jan 30 22:57 - 02:07  (03:09)   
root     tty1                          Thu Jan 12 23:36 - crash (17+23:19) 
root     pts/1        192.168.3.6      Thu Jan 12 18:03 - crash  (05:32)   
root     pts/0        192.168.3.6      Thu Jan 12 18:00 - crash  (05:35)   
root     pts/0        192.168.3.6      Wed Jan 11 17:26 - 02:00  (08:33)   
root     pts/0        192.168.3.6      Wed Jan 11 02:14 - 02:15  (00:01)   
root     tty1                          Wed Jan 11 01:14 - 01:18  (00:03)   
root     pts/0        192.168.3.6      Tue Jan 10 23:31 - 01:18  (01:47)   
root     pts/0        192.168.3.6      Tue Jan 10 19:13 - 23:24  (04:10)   
root     tty1                          Tue Jan 10 19:10 - 23:24  (04:14)   
root     tty1         :0               Tue Jan 10 19:04 - 19:05  (00:01)   
root     tty7         :0               Tue Jan 10 18:13 - crash  (08:01)   

wtmp begins Wed Jan 11 02:01:05 2012

last -n   例如最近5个登录信息

 [root@localhost tmp]# last -5
root     pts/2        192.168.3.38     Mon Feb 27 18:07   still logged in  
root     pts/1        192.168.3.38     Mon Feb 27 00:14 - 20:06  (19:52)   
root     pts/0        192.168.3.38     Fri Feb 24 00:59 - 18:10 (3+17:11)  
root     pts/0        192.168.3.38     Thu Feb 23 23:47 - 00:57  (01:10)   
root     tty1                          Thu Feb 23 00:13   still logged in  

wtmp begins Wed Jan 11 02:01:05 2012