'\" t .\" Title: last .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.26 .\" Date: 2026-04-01 .\" Manual: User Commands .\" Source: util-linux 2.42 .\" Language: English .\" .TH "LAST" "1" "2026-04-01" "util\-linux 2.42" "User Commands" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 .nh .ad l .de URL \fI\\$2\fP <\\$1>\\$3 .. .als MTO URL .if \n[.g] \{\ . mso www.tmac . am URL . ad l . . . am MTO . ad l . . . LINKSTYLE blue R < > .\} .SH "NAME" last, lastb \- show a listing of last logged in users .SH "SYNOPSIS" .sp \fBlast\fP [options] [\fIusername\fP|\fItty\fP].\|.\|. .sp \fBlastb\fP [options] [\fIusername\fP|\fItty\fP].\|.\|. .SH "DESCRIPTION" .sp \fBlast\fP searches back through the \fI/var/log/wtmp\fP file (or the file given with the \fB\-f\fP option) and displays a list of all users who logged in (and out) since that file was created. One or more \fIusernames\fP and/or \fIttys\fP can be given, in which case \fBlast\fP will show only the entries matching those arguments. (Names of \fIttys\fP can be abbreviated, thus \fBlast 0\fP is the same as \fBlast tty0\fP.) .sp When catching a \fBSIGINT\fP or \fBSIGQUIT\fP signal, \fBlast\fP will show how far it has searched through the file, and in case of the \fBSIGINT\fP signal (generated by the interrupt key, usually control\-C) \fBlast\fP will then terminate. .sp The pseudo user \fBreboot\fP logs in each time the system is rebooted. Thus \fBlast reboot\fP will show a log of all the reboots since the log file was created. .sp \fBlastb\fP is the same as \fBlast\fP, except that by default it shows a log of the \fI/var/log/btmp\fP file, which contains all the bad login attempts. .SH "OPTIONS" .sp \fB\-a\fP, \fB\-\-hostlast\fP .RS 4 Display the hostname in the last column. Useful in combination with the \fB\-d\fP option. .RE .sp \fB\-d\fP, \fB\-\-dns\fP .RS 4 For non\-local logins, Linux stores not only the host name of the remote host, but its IP number as well. This option translates the IP number back into a hostname. .RE .sp \fB\-f\fP, \fB\-\-file\fP \fIfile\fP .RS 4 Tell \fBlast\fP to use a specific \fIfile\fP instead of \fI/var/log/wtmp\fP. The \fB\-f\fP option can be given multiple times, and all of the specified files will be processed. .RE .sp \fB\-F\fP, \fB\-\-fulltimes\fP .RS 4 Print full login and logout times and dates. .RE .sp \fB\-i\fP, \fB\-\-ip\fP .RS 4 Like \fB\-d\fP, but displays the host\(cqs IP number instead of the name. .RE .sp \fB\-n\fP, \fB\-\-limit\fP \fInumber\fP .RS 4 The maximum amount of logins to show. .RE .sp \fB\-\fP\fInumber\fP .RS 4 The same as \fB\-n\fP \fInumber\fP. .RE .sp \fB\-p\fP, \fB\-\-present\fP \fItime\fP .RS 4 Display the users who were present at the specified \fItime\fP. For ways to specify \fItime\fP, see the section \fBTIME FORMATS\fP below. .RE .sp \fB\-R\fP, \fB\-\-nohostname\fP .RS 4 Suppresses the display of the hostname field. .RE .sp \fB\-s\fP, \fB\-\-since\fP \fItime\fP .RS 4 Display the state of logins since the specified \fItime\fP. The option can be combined with \fB\-t\fP to cover a period. .RE .sp \fB\-t\fP, \fB\-\-until\fP \fItime\fP .RS 4 Display the state of logins until the specified \fItime\fP. .RE .sp \fB\-T\fP, \fB\-\-tab\-separated\fP .RS 4 Use ASCII \fBtab\fP characters to separate the columns in the output instead of spaces. .RE .sp \fB\-\-time\-format\fP \fIformat\fP .RS 4 Define the appearance of the timestamp to be one of: \fBnotime\fP, \fBshort\fP, \fBfull\fP, or \fBiso\fP. The \fBnotime\fP variant will not print any timestamps at all, \fBshort\fP is the default, and \fBfull\fP is the same as the \fB\-\-fulltimes\fP option. The \fBiso\fP variant will display the timestamp in ISO\-8601 format. The ISO format contains timezone information, making it preferable when printouts are investigated outside of the system. .RE .sp \fB\-w\fP, \fB\-\-fullnames\fP .RS 4 Display full user names and domain names / IP addresses. When this option is not specified, user names are truncated to 8 characters, and domain names and IP addresses to 16 characters. An asterisk is shown as the last character of truncated fields. .RE .sp \fB\-x\fP, \fB\-\-system\fP .RS 4 Display the system shutdown entries and run level changes. .RE .sp \fB\-h\fP, \fB\-\-help\fP .RS 4 Display help text and exit. .RE .sp \fB\-V\fP, \fB\-\-version\fP .RS 4 Display version and exit. .RE .SH "TIME FORMATS" .sp The argument \fItime\fP allows the following forms: .sp .if n .RS 4 .nf .fam C 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) .fam .fi .if n .RE .sp Examples of the \fB\-\fP\fInumber\fP[\fBsmhd\fP] format are: \fB\-5m\fP, \fB\-6h\fP, \fB\-2d\fP. The unit specifier may be longer: \fB\-5min\fP, \fB\-6hours\fP, \fB\-2days\fP. .SH "FILES" .sp \fI/var/log/wtmp\fP, \fI/var/log/btmp\fP .SH "NOTES" .sp The files \fIwtmp\fP and \fIbtmp\fP 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 \fBtouch\fP(1) command (for example, \fBtouch /var/log/wtmp\fP). .sp 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. .sp 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 \fBlast\fP. The usual limits are 32 bytes for a user and line name and 256 bytes for a hostname. .SH "AUTHORS" .sp .MTO "miquels\(atcistron.nl" "Miquel van Smoorenburg" "" .SH "SEE ALSO" .sp \fBlogin\fP(1), \fBwtmp\fP(5), \fBinit\fP(8), \fBshutdown\fP(8) .SH "REPORTING BUGS" .sp For bug reports, use the \c .URL "https://github.com/util\-linux/util\-linux/issues" "issue tracker" "." .SH "AVAILABILITY" .sp The \fBlast\fP command is part of the util\-linux package which can be downloaded from \c .URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."