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