LAST(1)

๐Ÿ’– LAST(1) โ€” the "who was here" manual, bestie edition ๐Ÿ’–

okay so you want to know who logged in, when, and from where? Say less. This is the last manual page from the User Commands corner of the util-linux universe, and I'm gonna walk you through it like we're texting at 2am. ๐Ÿฆ‹


โœจ NAME โœจ

last, lastb โ€” show a listing of last logged in users ๐Ÿ’…


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

last [options] [username|tty]...

lastb [options] [username|tty]...

๐ŸŒธ DESCRIPTION ๐ŸŒธ

So last searches backwards through the /var/log/wtmp file โ€” or whichever file you hand it with the -f option โ€” and shows you a whole list of every user who logged in (and out ๐Ÿซถ) since that file was created. It's giving receipts, honestly.

You can also pass one or more usernames and/or ttys, and then last will show only the entries that match those arguments. And here's a cute little shortcut: tty names can be abbreviated, so last 0 hits the exact same as last tty0. iykyk. โœจ

When it catches a SIGINT or SIGQUIT signal, last will show how far it has searched through the file. And in the case of the SIGINT signal (that's the one your interrupt key generates, usually control-C), last will then terminate. ๐Ÿ˜ญ so dramatic of it.

The pseudo user reboot logs in each time the system is rebooted. So last reboot will show a log of all the reboots since the log file was created. Main character energy fr fr. ๐Ÿ‘‘

lastb is the same as last, except that by default it shows a log of the /var/log/btmp file, which contains all the bad login attempts. ๐Ÿ™ˆ (the flops, the fails, the "wrong password" girlies)


๐Ÿ’… OPTIONS ๐Ÿ’…

  • -a, --hostlast โ€” shows the hostname in the last column. Chef's kiss when you pair it with the -d option.
  • -d, --dns โ€” for non-local logins, Linux stores not just the host name of the remote host but its IP number too. This option translates that IP number back into a hostname. โœจ
  • -f, --file file โ€” tells last to use a specific file instead of /var/log/wtmp. And plot twist: you can give -f multiple times, and all of the specified files will be processed. obsessed.
  • -F, --fulltimes โ€” prints full login and logout times and dates. no more mystery. โญ
  • -i, --ip โ€” like -d, but displays the host's IP number instead of the name. pick your fighter.
  • -n, --limit number โ€” the maximum amount of logins to show. boundaries, periodt.
  • -number โ€” the same as -n number. just shorter. ๐Ÿ’…
  • -p, --present time โ€” displays the users who were present at the specified time. for ways to specify time, peep the TIME FORMATS section down below ๐Ÿ‘‡
  • -R, --nohostname โ€” suppresses the display of the hostname field. bye bestie ๐Ÿซถ
  • -s, --since time โ€” displays the state of logins since the specified time. can be combined with -t to cover a period. iconic duo.
  • -t, --until time โ€” displays the state of logins until the specified time. ๐ŸŒธ
  • -T, --tab-separated โ€” uses ASCII tab characters to separate the columns in the output instead of spaces. for the spreadsheet girlies. ๐Ÿ“Š
  • --time-format format โ€” defines the appearance of the timestamp to be one of: notime, short, full, or iso. The notime variant will not print any timestamps at all, short is the default, and full is the same as the --fulltimes option. The iso variant displays the timestamp in ISO-8601 format. And ngl, the ISO format contains timezone information, making it preferable when printouts are investigated outside of the system. ๐ŸŒˆ
  • -w, --fullnames โ€” displays full user names and domain names / IP addresses. When this option is not specified, user names get truncated to 8 characters, and domain names and IP addresses to 16 characters. An asterisk is shown as the last character of truncated fields. the little * is doing so much. ๐Ÿ’€
  • -x, --system โ€” displays the system shutdown entries and run level changes. ๐Ÿ”ฅ
  • -h, --help โ€” displays help text and exits. the "just tell me what to do" button.
  • -V, --version โ€” displays version and exits. ๐ŸŽ€

โฐ TIME FORMATS โฐ

The argument time allows the following forms:

YYYYMMDDhhmmss
"YYYY-MM-DD hh:mm:ss"
"YYYY-MM-DD hh:mm"      (seconds is 00)
YYYY-MM-DD              (time is 00:00:00)
hh:mm:ss                (date is today)
hh:mm                   (date is today, seconds is 00)
now
today                   (time is 00:00:00)
yesterday               (time is 00:00:00)
-number[smhd]           (seconds/minutes/hours/days before now)

Examples of the -number[smhd] format are: -5m, -6h, -2d. And the unit specifier may be longer: -5min, -6hours, -2days. she's flexible like that. ๐Ÿงš


๐Ÿ“ FILES ๐Ÿ“

/var/log/wtmp, /var/log/btmp

๐Ÿซถ NOTES ๐Ÿซถ

The files wtmp and btmp might not be found. The system only logs information in these files if they are present. This is a local configuration issue. If you want the files to be used, they can be created with a simple touch(1) command (for example, touch /var/log/wtmp). lowkey a vibe check for your system setup. โœจ

An empty entry is a valid type of wtmp entry. It means that an empty file or file with zeros is not interpreted as an error. so don't panic bestie.

The utmp file format uses fixed sizes of strings, which means that very long strings are impossible to store in the file and impossible to display by last. The usual limits are 32 bytes for a user and line name and 256 bytes for a hostname. no cap, that's just the format. ๐Ÿ˜ญ


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

Miquel van Smoorenburg <miquels@cistron.nl>


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

login(1), wtmp(5), init(8), shutdown(8)


๐Ÿ› REPORTING BUGS ๐Ÿ›

For bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>. pls be nice to the maintainers, they're doing their best. ๐Ÿ’–


๐Ÿ’œ AVAILABILITY ๐Ÿ’œ

The last 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!! ๐ŸŽ€ this one's coming at you from util-linux 2.42.4, dated 2026-09-21, and it's the LAST(1) manual โ€” slay, read responsibly, and go check who's been logging into your machine ๐Ÿ‘€๐Ÿ’…

๐Ÿ“ฆ where this page comes from
  • arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms