lastlog

Display the latest login information of all users in the system

Supplementary instructions

lastlog command is used to display the latest login information of all users in the system.

The lastlog file is queried each time a user logs in. You can use the lastlog command to check the last login time of a specific user and format and output the contents of the last login log /var/log/lastlog. It displays the login name, port number (tty) and last login time sorted by UID. If a user has never logged in, the lastlog displays **Never logged**. Note that you need to run this command as root.

grammar

lastlog(option)

Options

-b<number of days>: Display login information before the specified number of days;
-h: Display help information for the summons order;
-t<number of days>: Display login information since the specified number of days;
-u<username>: Display the latest login information of the specified user.

Example

lastlog
Username Port From Latest
root pts/0 221.6.45.34 Tue Dec 17 09:40:48 +0800 2013
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**
news **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**
vcsa **Never logged in**
ntp **Never logged in**
sshd **Never logged in**
nscd **Never logged in**
ldap **Never logged in**
postfix **Never logged in**
www **Never logged in**
mysql **Never logged in**