lastlog28
Displays date of last login for all users or a specific one
Usage
lastlog2 [options]
Overview
lastlog2 displays the content of the last-login database. The login-name, last-login-time, tty and remote-host will be printed. By default (no flags) all last-login entries are printed, in the order they were first written into the database.
If a user has never logged in, the message **Never logged in** is displayed in the last-login-time column.
Only the entries for the current users of the system are displayed. Other entries may exist for users that have meanwhile been deleted.
Compared to lastlog(8), this command is Y2038-safe, and uses SQLite3 instead of a sparse file to store the information.
Options
-
-a, --active -
Do not print entries for users who have never logged in.
-
-b, --before days -
Print only the last-login records older than days.
-
-C, --clear -
Clear the last-login record of a user. This option can only be used together with
-u(--user).
-
-d, --database file -
Use file as
lastlog2database.
-
-i, --import file -
Import data from an old lastlog file named file. Existing entries in the lastlog2 database will be overwritten.
-
-r, --rename newname -
Rename the user given with
-uto this newname. This option can only be used together with-u(--user).
-
-s, --service -
Display the PAM service used to login in the last column.
-
-S, --set -
Set the 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, --user login -
Print (or modify) the last-login record of the user login.
-
-h, --help -
Display help text and exit.
-
-V, --version -
Display version and exit.
Files
/var/lib/lastlog/lastlog2.db
Lastlog2 logging database file
Releases
2 releases since Debian 13 (Trixie); the text changed 1 time.
--database since Arch Linux 2026-11-01;
--user since Arch Linux 2026-11-01;
-V since Arch Linux 2026-11-01;
-d since Arch Linux 2026-11-01.
--users until Debian 13 (Trixie);
-v until Debian 13 (Trixie).