xref: /netbsd-src/usr.bin/last/last.1 (revision aaf4ece63a859a04e37cf3a7229b5fab0157cc06)
1.\"	$NetBSD: last.1,v 1.16 2005/03/05 14:28:31 wiz Exp $
2.\"
3.\" Copyright (c) 1980, 1990, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"     @(#)last.1	8.1 (Berkeley) 6/6/93
31.\"
32.Dd March 4, 2005
33.Dt LAST 1
34.Os
35.Sh NAME
36.Nm last
37.Nd indicate last logins of users and ttys
38.Sh SYNOPSIS
39.Nm
40.Op Fl Ns Ar n
41.Op Fl nTx
42.Op Fl f Ar file
43.Op Fl H Ar hostsize
44.Op Fl h Ar host
45.Op Fl L Ar linesize
46.Op Fl N Ar namesize
47.Op Fl t Ar tty
48.Op user ...
49.Sh DESCRIPTION
50.Nm
51will list the sessions of specified
52.Ar users ,
53.Ar ttys ,
54and
55.Ar hosts ,
56in reverse time order.
57Each line of output contains
58the user name, the tty from which the session was conducted, any
59hostname, the start and stop times for the session, and the duration
60of the session.
61If the session is still continuing or was cut short by
62a crash or shutdown,
63.Nm
64will so indicate.
65.Pp
66.Bl -tag -width xHxhostsizexx
67.It Fl Ar n
68Limits the report to
69.Ar n
70lines.
71.It Fl f Ar file
72.Nm
73reads the file
74.Ar file
75instead of the default,
76.Pa /var/log/wtmpx
77or
78.Pa /var/log/wtmp .
79If the file ends with
80.Sq x ,
81it is treated as a
82.Xr utmpx 5
83format file, else it is treated as a
84.Xr utmp 5
85format file.
86.It Fl H Ar hostsize
87Use the provided hostsize as the width to format the host name field.
88.It Fl h Ar host
89.Ar Host
90names may be names or internet numbers.
91.It Fl L Ar linesize
92Use the provided linesize as the width to format the tty field.
93.It Fl N Ar namesize
94Use the provided namesize as the width to format the login name field.
95.It Fl n
96Print host addresses numerically.
97This option works only on
98.Xr wtmpx 5
99entries,
100and prints nothing on
101.Xr wtmp 5
102entries.
103.It Fl T
104Display better time information, including the year and seconds.
105.It Fl t Ar tty
106Specify the
107.Ar tty .
108Tty names may be given fully or abbreviated, for example,
109.Dq Li "last -t 03"
110is equivalent to
111.Dq Li "last -t tty03" .
112.It Fl x
113Assume that the file given is
114.Xr wtmpx 5
115format, even if the filename does not end with an
116.Sq x .
117.El
118.Pp
119If multiple arguments are given, the information which applies to any of the
120arguments is printed, e.g.,
121.Dq Li "last root -t console"
122would list all of
123.Dq Li root Ns 's
124sessions as well as all sessions on the console terminal.
125If no users, hostnames, or terminals are specified,
126.Nm
127prints a record of all logins and logouts.
128.Pp
129The pseudo-user
130.Ar reboot
131logs in at reboots of the system, thus
132.Dq Li last reboot
133will give an indication of mean time between reboot.
134.Pp
135If
136.Nm
137is interrupted, it indicates to what date the search has progressed.
138If interrupted with a quit signal
139.Nm
140indicates how far the search has progressed and then continues.
141.Sh FILES
142.Bl -tag -width /var/log/wtmpx -compact
143.It Pa /var/log/wtmp
144login data base
145.It Pa /var/log/wtmpx
146login data base
147.El
148.Sh SEE ALSO
149.Xr lastcomm 1 ,
150.Xr utmp 5 ,
151.Xr utmpx 5 ,
152.Xr ac 8
153.Sh HISTORY
154.Nm
155appeared in
156.Bx 3.0 .
157