Scroll to navigation

LASTLOG2(8) User Commands LASTLOG2(8)


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


lastlog2 [options]


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.


-b, --before DAYS

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, --import FILE

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

-r, --rename NEWNAME

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

-s, --servive num

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, --time DAYS

Print only last login records more recent than DAYS.

-u, --users LOGINS

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 Never logged in 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.



Lastlog2 logging database file


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




For bug reports, use the issue tracker at <>.


The lastlog2 command is part of the util-linux package which can be downloaded from Linux Kernel Archive <>.

2024-05-01 util-linux 2.40.1