xref: /freebsd/usr.bin/last/last.1 (revision a8445737e740901f5f2c8d24c12ef7fc8b00134e)
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.\"
34.Dd June 6, 1993
35.Dt LAST 1
36.Os BSD 4
37.Sh NAME
38.Nm last
39.Nd indicate last logins of users and ttys
40.Sh SYNOPSIS
41.Nm last
42.Op Fl Ns Ar n
43.Op Fl f Ar file
44.Op Fl h Ar host
45.Op Fl s
46.Op Fl t Ar tty
47.Op Fl w
48.Op user ...
49.Sh DESCRIPTION
50.Nm Last
51will list the sessions of specified
52.Ar users ,
53.Ar ttys ,
54and
55.Ar hosts ,
56in reverse time order.  Each line of output contains
57the user name, the tty from which the session was conducted, any
58hostname, the start and stop times for the session, and the duration
59of the session.  If the session is still continuing or was cut short by
60a crash or shutdown,
61.Nm last
62will so indicate.
63.Pp
64.Bl -tag -width indent-two
65.It Fl Ar n
66Limits the report to
67.Ar n
68lines.
69.It Fl f Ar file
70.Nm Last
71reads the file
72.Ar file
73instead of the default,
74.Pa /var/log/wtmp .
75.It Fl h Ar host
76.Ar Host
77names may be names or internet numbers.
78.It Fl s
79Report the duration of the login session in seconds, instead of the
80default days, hours and minutes.
81.It Fl t Ar tty
82Specify the
83.Ar tty .
84Tty names may be given fully or abbreviated, for example,
85.Dq Li "last -t 03"
86is
87equivalent to
88.Dq Li "last -t tty03" .
89.It Fl w
90Widen the duration field to show seconds, as well as the
91default days, hours and minutes.
92.El
93.Pp
94If
95multiple arguments are given, the information which applies to any of the
96arguments is printed, e.g.,
97.Dq Li "last root -t console"
98would list all of
99.Dq Li root Ns 's
100sessions as well as all sessions on the console terminal. If no
101users, hostnames or terminals are specified,
102.Nm last
103prints a record of
104all logins and logouts.
105.Pp
106The pseudo-user
107.Ar reboot
108logs in at reboots of the system, thus
109.Dq Li last reboot
110will give an indication of mean time between reboot.
111.Pp
112If
113.Nm last
114is interrupted, it indicates to what date the search has
115progressed.  If interrupted with a quit signal
116.Nm last
117indicates how
118far the search has progressed and then continues.
119.Sh FILES
120.Bl -tag -width /var/log/wtmp -compact
121.It Pa /var/log/wtmp
122login data base
123.El
124.Sh SEE ALSO
125.Xr lastcomm 1 ,
126.Xr utmp 5 ,
127.Xr ac 8
128.Sh BUGS
129If a login shell should terminate abnormally for some reason, it is likely
130that a logout record won't be written to the wtmp file. In this case,
131.Nm last
132will indicate the logout time as "shutdown".
133.Sh HISTORY
134.Nm Last
135appeared in
136.Bx 3.0 .
137