]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/last/last.1
This commit was generated by cvs2svn to compensate for changes in r79543,
[FreeBSD/FreeBSD.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 May 2, 2001
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 Ns Ar n
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 s
56 .Op Fl t Ar tty
57 .Op Fl w
58 .Op Ar user ...
59 .Sh DESCRIPTION
60 .Nm Last
61 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 .Bl -tag -width indent-two
78 .It Fl Ar n
79 Limits the report to
80 .Ar n
81 lines.
82 .It Fl d Ar date
83 Specify the snapshot date and time.
84 All users logged in at the snapshot date and time will
85 be reported.
86 This may be used with the
87 .Fl f
88 option to derive the results from stored wtmp files.
89 When this argument is provided, all other options except for
90 .Fl f
91 and
92 .Fl Ar n
93 are ignored.
94 The argument should be in the form
95 .Sm off
96 .Op Oo Ar CC Oc Ar YY
97 .Op Ar MM DD
98 .Ar hh mm
99 .Op Ar .SS
100 .Sm on
101 where each pair of letters represents the following:
102 .Pp
103 .Bl -tag -width Ds -compact -offset indent
104 .It Ar CC
105 The first two digits of the year (the century).
106 .It Ar YY
107 The second two digits of the year.
108 If
109 .Ar YY
110 is specified, but
111 .Ar CC
112 is not, a value for
113 .Ar YY
114 between 69 and 99 results in a
115 .Ar CC
116 value of 19.
117 Otherwise, a
118 .Ar CC
119 value of 20 is used.
120 .It Ar MM
121 Month of the year, from 1 to 12.
122 .It Ar DD
123 Day of the month, from 1 to 31.
124 .It Ar hh
125 Hour of the day, from 0 to 23.
126 .It Ar mm
127 Minute of the hour, from 0 to 59.
128 .It Ar SS
129 Second of the minute, from 0 to 61.
130 .El
131 .Pp
132 If the
133 .Ar CC
134 and
135 .Ar YY
136 letter pairs are not specified, the values default to the current
137 year.
138 If the
139 .Ar SS
140 letter pair is not specified, the value defaults to 0.
141 .It Fl f Ar file
142 .Nm Last
143 reads the file
144 .Ar file
145 instead of the default,
146 .Pa /var/log/wtmp .
147 .It Fl h Ar host
148 .Ar Host
149 names may be names or internet numbers.
150 .It Fl s
151 Report the duration of the login session in seconds, instead of the
152 default days, hours and minutes.
153 .It Fl t Ar tty
154 Specify the
155 .Ar tty .
156 Tty names may be given fully or abbreviated, for example,
157 .Dq Li "last -t 03"
158 is
159 equivalent to
160 .Dq Li "last -t tty03" .
161 .It Fl w
162 Widen the duration field to show seconds, as well as the
163 default days, hours and minutes.
164 .El
165 .Pp
166 If multiple arguments are given,
167 and a snapshot time is not specified,
168 the information which applies to any of the
169 arguments is printed, e.g.,
170 .Dq Li "last root -t console"
171 would list all of
172 .Dq Li root Ns 's
173 sessions as well as all sessions on the console terminal.
174 If no
175 users, hostnames or terminals are specified,
176 .Nm
177 prints a record of
178 all logins and logouts.
179 .Pp
180 The pseudo-user
181 .Ar reboot
182 logs in at reboots of the system, thus
183 .Dq Li last reboot
184 will give an indication of mean time between reboot.
185 .Pp
186 If
187 .Nm
188 is interrupted, it indicates to what date the search has
189 progressed.
190 If interrupted with a quit signal
191 .Nm
192 indicates how
193 far the search has progressed and then continues.
194 .Sh FILES
195 .Bl -tag -width /var/log/wtmp -compact
196 .It Pa /var/log/wtmp
197 login data base
198 .El
199 .Sh SEE ALSO
200 .Xr lastcomm 1 ,
201 .Xr utmp 5 ,
202 .Xr ac 8
203 .Sh BUGS
204 If a login shell should terminate abnormally for some reason, it is likely
205 that a logout record won't be written to the wtmp file.
206 In this case,
207 .Nm
208 will indicate the logout time as "shutdown".
209 .Sh HISTORY
210 .Nm Last
211 appeared in
212 .Bx 3.0 .