]> git.ipfire.org Git - thirdparty/util-linux.git/blob - login-utils/last.1
Manual pages: order NOTES / HISTORY / BUGS / EXAMPLE consistently
[thirdparty/util-linux.git] / login-utils / last.1
1 .\" Copyright (C) 1998-2004 Miquel van Smoorenburg.
2 .\"
3 .\" This program is free software; you can redistribute it and/or modify
4 .\" it under the terms of the GNU General Public License as published by
5 .\" the Free Software Foundation; either version 2 of the License, or
6 .\" (at your option) any later version.
7 .\"
8 .\" This program is distributed in the hope that it will be useful,
9 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
10 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 .\" GNU General Public License for more details.
12 .\"
13 .\" You should have received a copy of the GNU General Public License
14 .\" along with this program; if not, write to the Free Software
15 .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 .\"
17 .TH "LAST, LASTB" "1" "October 2013" "util-linux" "User Commands"
18 .SH NAME
19 last, lastb \- show a listing of last logged in users
20 .SH SYNOPSIS
21 .B last
22 [options]
23 .RI [ username "...] [" tty ...]
24 .br
25 .B lastb
26 [options]
27 .RI [ username "...] [" tty ...]
28 .SH DESCRIPTION
29 .B last
30 searches back through the
31 .I /var/log/wtmp
32 file (or the file designated by the
33 .B \-f
34 option) and displays a list of all users logged in (and out) since that
35 file was created. One or more
36 .IR usernames " and/or " ttys
37 can be given, in which case
38 .B last
39 will show only the entries matching those arguments. Names of
40 .I ttys
41 can be abbreviated, thus
42 .B last 0
43 is the same as
44 .BR "last tty0" .
45 .PP
46 When catching a SIGINT signal (generated by the interrupt key, usually
47 control-C) or a SIGQUIT signal,
48 .B last
49 will show how far it has searched through the file; in the case of the
50 SIGINT signal
51 .B last
52 will then terminate.
53 .PP
54 The pseudo user
55 .B reboot
56 logs in each time the system is rebooted. Thus
57 .B last reboot
58 will show a log of all the reboots since the log file was created.
59 .PP
60 .B lastb
61 is the same as
62 .BR last ,
63 except that by default it shows a log of the
64 .I /var/log/btmp
65 file, which contains all the bad login attempts.
66 .SH OPTIONS
67 .TP
68 .BR \-a , " \-\-hostlast"
69 Display the hostname in the last column. Useful in combination with the
70 .B \-\-dns
71 option.
72 .TP
73 .BR \-d , " \-\-dns"
74 For non-local logins, Linux stores not only the host name of the remote
75 host, but its IP number as well. This option translates the IP number
76 back into a hostname.
77 .TP
78 .BR \-f , " \-\-file " \fIfile\fR
79 Tell
80 .B last
81 to use a specific \fIfile\fR instead of
82 .IR /var/log/wtmp .
83 The
84 .B \-\-file
85 option can be given multiple times, and all of the specified files will be
86 processed.
87 .TP
88 .BR \-F , " \-\-fulltimes"
89 Print full login and logout times and dates.
90 .TP
91 .BR \-i , " \-\-ip"
92 Like
93 .B \-\-dns ,
94 but displays the host's IP number instead of the name.
95 .TP
96 .BI \- number
97 .TQ
98 .BR \-n , " -\-limit " \fInumber\fR
99 Tell
100 .B last
101 how many lines to show.
102 .TP
103 .BR \-p , " \-\-present " \fItime\fR
104 Display the users who were present at the specified time. This is
105 like using the options
106 .BR \-\-since " and " \-\-until
107 together with the same \fItime\fR.
108 .TP
109 .BR \-R , " \-\-nohostname"
110 Suppresses the display of the hostname field.
111 .TP
112 .BR \-s , " \-\-since " \fItime\fR
113 Display the state of logins since the specified
114 .IR time .
115 This is useful, e.g., to easily determine who was logged in at a
116 particular time. The option is often combined with
117 .BR \-\-until .
118 .TP
119 .BR \-t , " \-\-until " \fItime\fR
120 Display the state of logins until the specified
121 .IR time .
122 .TP
123 .BI \-\-time\-format " format"
124 Define the output timestamp
125 .I format
126 to be one of
127 .IR notime ,
128 .IR short ,
129 .IR full ,
130 or
131 .IR iso .
132 The
133 .I notime
134 variant will not print any timestamps at all,
135 .I short
136 is the default, and
137 .I full
138 is the same as the
139 .B \-\-fulltimes
140 option. The
141 .I iso
142 variant will display the timestamp in ISO-8601 format. The ISO format
143 contains timezone information, making it preferable when printouts are
144 investigated outside of the system.
145 .TP
146 .BR \-w , " \-\-fullnames"
147 Display full user names and domain names in the output.
148 .TP
149 .BR \-x , " \-\-system"
150 Display the system shutdown entries and run level changes.
151 .SH TIME FORMATS
152 The options that take the
153 .I time
154 argument understand the following formats:
155 .TS
156 l2 l.
157 YYYYMMDDhhmmss
158 YYYY-MM-DD hh:mm:ss
159 YYYY-MM-DD hh:mm (seconds will be set to 00)
160 YYYY-MM-DD (time will be set to 00:00:00)
161 hh:mm:ss (date will be set to today)
162 hh:mm (date will be set to today, seconds to 00)
163 now
164 yesterday (time is set to 00:00:00)
165 today (time is set to 00:00:00)
166 tomorrow (time is set to 00:00:00)
167 +5min
168 -5days
169 .TE
170 .SH FILES
171 /var/log/wtmp
172 .br
173 /var/log/btmp
174 .SH NOTES
175 The files
176 .I wtmp
177 and
178 .I btmp
179 might not be found. The system only logs information in these files if
180 they are present. This is a local configuration issue. If you want the
181 files to be used, they can be created with a simple
182 .BR touch (1)
183 command (for example,
184 .IR "touch /var/log/wtmp" ).
185 .SH AUTHORS
186 .MT miquels@cistron.nl
187 Miquel van Smoorenburg
188 .ME
189 .SH SEE ALSO
190 .BR login (1),
191 .BR wtmp (5),
192 .BR init (8),
193 .BR shutdown (8)
194 .SH AVAILABILITY
195 The last command is part of the util-linux package and is available from
196 .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
197 Linux Kernel Archive
198 .UE .