logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

lastlog2 - displays date of last login for all users or a specific one

Authors

       lastlog2 was written by Thorsten Kukuk for liblastlog2(3).

Availability

       The lastlog2 command is part of the util-linux package which can be downloaded from Linux Kernel Archive
       <https://www.kernel.org/pub/linux/utils/util-linux/>.

util-linux 2.41                                    2025-03-04                                        LASTLOG2(8)

Description

lastlog2 displays the content of the last login database. The login-name, last-login-time, tty and
       remote-host will be printed. The default (no flags) causes all last login entries to be printed, sorted
       by the order as written the first time into the database.

       Compared to lastlog this command is Y2038 safe and uses sqlite3 to store the information and not a sparse
       file.

Files

/var/lib/lastlog/lastlog2.db
           Lastlog2 logging database file

Name

       lastlog2 - displays date of last login for all users or a specific one

Options

-a, --active
           Print last login records excluding users who have never logged in.

       -b, --beforeDAYS
           Print only last login records older than DAYS.

       -C, --clear
           Clear last login record of a user. This option can be used only together with -u'(--user*).

       -d, *--database FILE
           Use FILE as lastlog2 database.

       -h, --help
           Display help message and exit.

       -i, --importFILE
           Import data from old lastlog file FILE. Existing entries in the lastlog2 database will be
           overwritten.

       -r, --renameNEWNAME
           This option can only be used together with -u (--user).

       -s, --servicenum
           Display PAM service used to login in the last column.

       -S, --set
           Set last login record of a user to the current time. This option can only be used together with -u
           (--user).

       -t, --timeDAYS
           Print only last login records more recent than DAYS.

       -u, --usersLOGINS
           Print only the last login record of the user LOGIN.

       -v, --version
           Print version number and exit.

       If the user has never logged in the message Neverloggedin will be displayed in the latest login time
       row.

       Only the entries for the current users of the system will be displayed. Other entries may exist for users
       that were deleted previously.

Reporting Bugs

       For bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>.

See Also

liblastlog2(3)

Synopsis

lastlog2 [options]

See Also