]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - usr.bin/last/last.1
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / usr.bin / last / last.1
1 .\" Copyright (c) 1980, 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)last.1      8.1 (Berkeley) 6/6/93
33 .\" $FreeBSD$
34 .\"
35 .Dd July 27, 2003
36 .Dt LAST 1
37 .Os
38 .Sh NAME
39 .Nm last
40 .Nd indicate last logins of users and ttys
41 .Sh SYNOPSIS
42 .Nm
43 .Op Fl swy
44 .Oo
45 .Fl d
46 .Sm off
47 .Op Oo Ar CC Oc Ar YY
48 .Op Ar MM DD
49 .Ar hh mm
50 .Op Ar .SS
51 .Sm on
52 .Oc
53 .Op Fl f Ar file
54 .Op Fl h Ar host
55 .Op Fl n Ar maxrec
56 .Op Fl t Ar tty
57 .Op Ar user ...
58 .Sh DESCRIPTION
59 The
60 .Nm
61 utility will either list the sessions of specified
62 .Ar users ,
63 .Ar ttys ,
64 and
65 .Ar hosts ,
66 in reverse time order,
67 or list the users logged in at a specified date and time.
68 Each line of output contains
69 the user name, the tty from which the session was conducted, any
70 hostname, the start and stop times for the session, and the duration
71 of the session.
72 If the session is still continuing or was cut short by
73 a crash or shutdown,
74 .Nm
75 will so indicate.
76 .Pp
77 The following options are available:
78 .Bl -tag -width indent-two
79 .It Fl d Ar date
80 Specify the snapshot date and time.
81 All users logged in at the snapshot date and time will
82 be reported.
83 This may be used with the
84 .Fl f
85 option to derive the results from stored
86 .Pa wtmp
87 files.
88 When this argument is provided, all other options except for
89 .Fl f
90 and
91 .Fl n
92 are ignored.
93 The argument should be in the form
94 .Sm off
95 .Op Oo Ar CC Oc Ar YY
96 .Op Ar MM DD
97 .Ar hh mm
98 .Op Ar .SS
99 .Sm on
100 where each pair of letters represents the following:
101 .Pp
102 .Bl -tag -width Ds -compact -offset indent
103 .It Ar CC
104 The first two digits of the year (the century).
105 .It Ar YY
106 The second two digits of the year.
107 If
108 .Ar YY
109 is specified, but
110 .Ar CC
111 is not, a value for
112 .Ar YY
113 between 69 and 99 results in a
114 .Ar CC
115 value of 19.
116 Otherwise, a
117 .Ar CC
118 value of 20 is used.
119 .It Ar MM
120 Month of the year, from 1 to 12.
121 .It Ar DD
122 Day of the month, from 1 to 31.
123 .It Ar hh
124 Hour of the day, from 0 to 23.
125 .It Ar mm
126 Minute of the hour, from 0 to 59.
127 .It Ar SS
128 Second of the minute, from 0 to 61.
129 .El
130 .Pp
131 If the
132 .Ar CC
133 and
134 .Ar YY
135 letter pairs are not specified, the values default to the current
136 year.
137 If the
138 .Ar SS
139 letter pair is not specified, the value defaults to 0.
140 .It Fl f Ar file
141 Read the file
142 .Ar file
143 instead of the default,
144 .Pa /var/log/wtmp .
145 .It Fl h Ar host
146 .Ar Host
147 names may be names or internet numbers.
148 .It Fl n Ar maxrec
149 Limit the report to
150 .Ar maxrec
151 lines.
152 .It Fl s
153 Report the duration of the login session in seconds, instead of the
154 default days, hours and minutes.
155 .It Fl t Ar tty
156 Specify the
157 .Ar tty .
158 Tty names may be given fully or abbreviated, for example,
159 .Dq Li "last -t 03"
160 is
161 equivalent to
162 .Dq Li "last -t tty03" .
163 .It Fl w
164 Widen the duration field to show seconds, as well as the
165 default days, hours and minutes.
166 .It Fl y
167 Report the year in the session start time.
168 .El
169 .Pp
170 If multiple arguments are given,
171 and a snapshot time is not specified,
172 the information which applies to any of the
173 arguments is printed, e.g.,
174 .Dq Li "last root -t console"
175 would list all of
176 .Dq Li root Ns 's
177 sessions as well as all sessions on the console terminal.
178 If no
179 users, hostnames or terminals are specified,
180 .Nm
181 prints a record of
182 all logins and logouts.
183 .Pp
184 The pseudo-user
185 .Ar reboot
186 logs in at reboots of the system, thus
187 .Dq Li last reboot
188 will give an indication of mean time between reboot.
189 .Pp
190 If
191 .Nm
192 is interrupted, it indicates to what date the search has
193 progressed.
194 If interrupted with a quit signal
195 .Nm
196 indicates how
197 far the search has progressed and then continues.
198 .Sh FILES
199 .Bl -tag -width /var/log/wtmp -compact
200 .It Pa /var/log/wtmp
201 login data base
202 .El
203 .Sh SEE ALSO
204 .Xr lastcomm 1 ,
205 .Xr utmp 5 ,
206 .Xr ac 8
207 .Sh HISTORY
208 A
209 .Nm
210 utility appeared in
211 .Bx 3.0 .
212 .Sh BUGS
213 If a login shell should terminate abnormally for some reason, it is likely
214 that a logout record will not be written to the
215 .Pa wtmp
216 file.
217 In this case,
218 .Nm
219 will indicate the logout time as "shutdown".