CentOS Linux Server Guide

CentOS Linux System Information - Login History

Last

  • command to get the information of the user who has successfully logged into Linux system.

  • last command will refer to binary files of /var/log/wtmp and display the result to screen.

 

Synopsis

Last

Last username

 

Note

If last command used without specify any username, it will show login of all users.

 

Example A: Showing login history of all users
#last
lee pts/3 192.168.139.1 Thu Jan 21 11:16 still logged in
jane pts/4 192.168.139.1 Thu Jan 21 11:27 - 11:37 (00:10)
root pts/3 192.168.139.1 Thu Jan 21 11:14 - 11:16 (00:01)
root pts/2 Thu Jan 21 11:07 still logged in
root pts/1 Thu Jan 21 11:07 still logged in
root :0 Thu Jan 21 11:07 still logged in
reboot system boot 2.6.9-42.ELsmp Thu Jan 21 10:52 (00:24)
root pts/2 Wed Jan 20 22:00 - down (00:00)
root pts/1 Wed Jan 20 21:59 - down (00:01)
root :0 Wed Jan 20 21:59 - down (00:02)
reboot system boot 2.6.9-42.ELsmp Wed Jan 20 21:57 (00:04)

 

From the above example, we know the details of the login information as below

jane is login at 11:27 21th Jan and she logut 10 mins later at 11:37

 
jane           pts/4       192.168.139.1    Thu Jan 21 11:27    -      11:37           (00:10)

username    terminal   hostname or ip    login time and date         logout time    time of usage   

 

Example B: Showing login history of root user
# last root
root pts/3 192.168.139.1 Thu Jan 21 11:14 - 11:16 (00:01)
root pts/2 Thu Jan 21 11:07 still logged in
root pts/1 Thu Jan 21 11:07 still logged in
root :0 Thu Jan 21 11:07 still logged in
root pts/2 Wed Jan 20 22:00 - down (00:00)
root pts/1 Wed Jan 20 21:59 - down (00:01)
root :0 Wed Jan 20 21:59 - down (00:02)

¡¡

Read More about Obtaining CentOS Linux System Information



Copyright 2011 http://www.1a-centosserver.com All Rights Reserved

All trademarks are the property of their respective owners.

Contact Us | Terms of Use | Privacy Policy