lastlog
Linux · Users and permissions · reference only
What it does
Shows the most recent login of every account on the system, with the port and origin.
Syntax
lastlog [opciones]
Options and parameters
-u usuarioShows only that user's data (UID ranges are also accepted).
-t díasShows only logins from the last N days.
-b díasShows only logins older than N days ago.
-CClears the login record of the user given with -u (requires root).
-SSets the login record of the user given with -u to the current time (requires root).
Usage examples
lastlogLists the last login of every account.
lastlog -u anaShows only ana's last login.
lastlog -t 7Shows the accounts that logged in during the last week.
lastlog -b 90Finds accounts with no activity in the last 90 days.
Notes and common mistakes
- It reads the /var/log/lastlog file.
- Accounts that have never logged in are marked as such.