1.\" $NetBSD: last.1,v 1.14 2004/11/11 01:00:34 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 November 10, 2004 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 nT 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 wtmpx entries, 98and prints nothing on wtmp entries. 99.It Fl T 100Display better time information, including the year and seconds. 101.It Fl t Ar tty 102Specify the 103.Ar tty . 104Tty names may be given fully or abbreviated, for example, 105.Dq Li "last -t 03" 106is equivalent to 107.Dq Li "last -t tty03" . 108.El 109.Pp 110If multiple arguments are given, the information which applies to any of the 111arguments is printed, e.g., 112.Dq Li "last root -t console" 113would list all of 114.Dq Li root Ns 's 115sessions as well as all sessions on the console terminal. 116If no users, hostnames, or terminals are specified, 117.Nm 118prints a record of all logins and logouts. 119.Pp 120The pseudo-user 121.Ar reboot 122logs in at reboots of the system, thus 123.Dq Li last reboot 124will give an indication of mean time between reboot. 125.Pp 126If 127.Nm 128is interrupted, it indicates to what date the search has progressed. 129If interrupted with a quit signal 130.Nm 131indicates how far the search has progressed and then continues. 132.Sh FILES 133.Bl -tag -width /var/log/wtmpx -compact 134.It Pa /var/log/wtmp 135login data base 136.It Pa /var/log/wtmpx 137login data base 138.El 139.Sh SEE ALSO 140.Xr lastcomm 1 , 141.Xr utmp 5 , 142.Xr utmpx 5 , 143.Xr ac 8 144.Sh HISTORY 145.Nm 146appeared in 147.Bx 3.0 . 148