lastlog command prints the last login times for system accounts. Login information is read from the file /var/log/lastlog.
lastlog Command OPtions
Option | Description |
---|---|
-t n | Print only logins more recent than n days ago. |
-u name | Print only login information for user name. |
lastlog Command Examples
1. To print the last login of all the users:
# lastlog
2. To print the records of specified days older:
# lastlog -b 10 # lastlog --before 10
3. To print the logs more recent that specified days:
# lastlog -t 20 # lastlog --time 20
4. To print the last login records of specified login:
# lastlog -u mike # lastlog --user mike
5. To display the help for lastlog:
# lastlog --help
Note: lastlog reads from /var/log/lastlog and lists the most recent login for each account.