1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
'\" t
.\" Title: lastlog2
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.20
.\" Date: 2026-02-17
.\" Manual: User Commands
.\" Source: util-linux 2.42-rc1
.\" Language: English
.\"
.TH "LASTLOG2" "8" "2026-02-17" "util\-linux 2.42\-rc1" "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"
lastlog2 \- displays date of last login for all users or a specific one
.SH "SYNOPSIS"
.sp
\fBlastlog2\fP [options]
.SH "DESCRIPTION"
.sp
\fBlastlog2\fP displays the content of the last\-login database. The \fIlogin\-name\fP,
\fIlast\-login\-time\fP, \fItty\fP and \fIremote\-host\fP will be printed.
By default (no flags) all last\-login entries are printed,
in the order they were first written into the database.
.sp
If a user has never logged in, the message \fB**Never logged in**\fP
is displayed in the last\-login\-time column.
.sp
Only the entries for the current users of the system are displayed.
Other entries may exist for users that have meanwhile been deleted.
.sp
Compared to \fBlastlog\fP(8), this command is Y2038\-safe, and uses SQLite3
instead of a sparse file to store the information.
.SH "OPTIONS"
.sp
\fB\-a\fP, \fB\-\-active\fP
.RS 4
Do not print entries for users who have never logged in.
.RE
.sp
\fB\-b\fP, \fB\-\-before\fP \fIdays\fP
.RS 4
Print only the last\-login records older than \fIdays\fP.
.RE
.sp
\fB\-C\fP, \fB\-\-clear\fP
.RS 4
Clear the last\-login record of a user.
This option can only be used together with \fB\-u\fP (\fB\-\-user\fP).
.RE
.sp
\fB\-d\fP, \fB\-\-database\fP \fIfile\fP
.RS 4
Use \fIfile\fP as \fBlastlog2\fP database.
.RE
.sp
\fB\-i\fP, \fB\-\-import\fP \fIfile\fP
.RS 4
Import data from an old lastlog file named \fIfile\fP.
Existing entries in the lastlog2 database will be overwritten.
.RE
.sp
\fB\-r\fP, \fB\-\-rename\fP \fInewname\fP
.RS 4
Rename the user given with \fB\-u\fP to this \fInewname\fP.
This option can only be used together with \fB\-u\fP (\fB\-\-user\fP).
.RE
.sp
\fB\-s\fP, \fB\-\-service\fP
.RS 4
Display the PAM service used to login in the last column.
.RE
.sp
\fB\-S\fP, \fB\-\-set\fP
.RS 4
Set the last\-login record of a user to the current time.
This option can only be used together with \fB\-u\fP (\fB\-\-user\fP).
.RE
.sp
\fB\-t\fP, \fB\-\-time\fP \fIdays\fP
.RS 4
Print only last\-login records more recent than \fIdays\fP.
.RE
.sp
\fB\-u\fP, \fB\-\-user\fP \fIlogin\fP
.RS 4
Print (or modify) the last\-login record of the user \fIlogin\fP.
.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 "FILES"
.sp
\fB/var/lib/lastlog/lastlog2.db\fP
.RS 4
Lastlog2 logging database file
.RE
.SH "AUTHORS"
.sp
lastlog2 was written by Thorsten Kukuk for \fBliblastlog2\fP(3).
.SH "SEE ALSO"
.sp
\fBliblastlog2\fP(3)
.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 \fBlastlog2\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" "."
|