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