LASTLOG2(8)

✨ LASTLOG2 πŸ’…

okay so bestie, welcome to lastlog2 β€” that's section 8 of the manual, the User Commands girlies, and she is literally the main character of "when did everyone last log in" πŸŽ€


🌸 NAME 🌸

lastlog2 β€” displays date of last login for all users or a specific one ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

lastlog2 [options]

πŸ’– DESCRIPTION πŸ’–

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, like, just vibing with zero options) 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. (ghost user behaviour fr fr πŸ‘»)

Only the entries for the current users of the system are displayed. Other entries may exist for users that have meanwhile been deleted β€” RIP to them, but they're not on this list πŸ’€

Compared to lastlog(8), this command is Y2038-safe, and uses SQLite3 instead of a sparse file to store the information. no cap, she is future-proofed πŸ”₯


✨ OPTIONS ✨

  • -a, --active β€” Do not print entries for users who have never logged in. only the ones who actually showed up πŸ’…
  • -b, --before days β€” Print only the last-login records older than days. ancient history only 🏺
  • -C, --clear β€” Clear the last-login record of a user. This option can only be used together with -u (--user). she does NOT fly solo 🚫
  • -d, --database file β€” Use file as lastlog2 database. pick your own database, entrepreneur energy πŸ‘œ
  • -i, --import file β€” Import data from an old lastlog file named file. Existing entries in the lastlog2 database will be overwritten. ⚠️ yes bestie, overwritten β€” say bye to what was there πŸ™ˆ
  • -r, --rename newname β€” Rename the user given with -u to this newname. This option can only be used together with -u (--user). glow-up era, new name who dis ✨
  • -s, --service β€” Display the PAM service used to login in the last column. receipts on how they got in πŸ”
  • -S, --set β€” Set the last-login record of a user to the current time. This option can only be used together with -u (--user). time-travel, but make it now ⏰
  • -t, --time days β€” Print only last-login records more recent than days. fresh entries only, no stale vibes πŸ₯
  • -u, --user login β€” Print (or modify) the last-login record of the user login. the VIP pass to one specific person πŸ‘‘
  • -h, --help β€” Display help text and exit. 🫢
  • -V, --version β€” Display version and exit. ⭐

πŸŽ€ FILES πŸŽ€

  • /var/lib/lastlog/lastlog2.db β€” Lastlog2 logging database file πŸ—„οΈ

🌈 AUTHORS 🌈

lastlog2 was written by Thorsten Kukuk for liblastlog2(3). king behaviour, we stan πŸ‘


πŸ¦‹ SEE ALSO πŸ¦‹

  • liblastlog2(3)

(iykyk, go read the library page too πŸ’œ)


πŸ’€ REPORTING BUGS πŸ’€

For bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>. don't be shy, tell them what broke πŸ™ˆ


⭐ 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/>. go get her 🧚


πŸ’Œ and that's the whole page bestie β€” sourced from util-linux 2.42.2, dated 2026-06-16, filed under LASTLOG2(8). now go check who's been logging in πŸ“πŸ’–
πŸ“¦ where this page comes from