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