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