LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

lastlog

Report the most recent login of all users or a specified user

TLDR

Display most recent login of all users
$ lastlog
copy
Display lastlog for a specific user
$ lastlog --user [username]
copy
Display records older than N days
$ lastlog --before [7]
copy
Display records more recent than N days
$ lastlog --time [3]
copy

SYNOPSIS

lastlog [options]

DESCRIPTION

lastlog reports the most recent login of all users or a specified user by reading /var/log/lastlog. Unlike last, it shows only one record per user representing their most recent login.The lastlog file is a sparse file indexed by UID, so it can appear large but doesn't consume much disk space. Users who have never logged in show "Never logged in".

PARAMETERS

-u, --user LOGIN|RANGE

Show lastlog record for specified user(s). Can be a login name, numeric UID, or a UID range (UIDMIN-UIDMAX)
-b, --before DAYS
Show records older than DAYS
-t, --time DAYS
Show records more recent than DAYS
-C, --clear
Clear lastlog record for a user (requires -u)
-S, --set
Set lastlog record for a user to the current time (requires -u)
-R, --root CHROOT\DIR_
Apply changes in the CHROOT_DIR directory and use its configuration files
-h, --help
Display help message and exit

INSTALL

sudo apk add shadow-login
copy

CAVEATS

The lastlog file is indexed by UID; very high UIDs can make the file appear large. Some systems may not maintain lastlog. System accounts typically show as never logged in.

HISTORY

lastlog has been part of Unix-like systems for decades, providing a quick way to audit which users have logged in recently and identify dormant accounts.

SEE ALSO

last(1), lastb(1), faillog(8), who(1), login(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid