1.\" $NetBSD: last.1,v 1.18 2007/07/27 16:59:25 reed 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 December 27, 2006 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. 86If the file is ``-'', standard input is used. 87.It Fl H Ar hostsize 88Use the provided hostsize as the width to format the host name field. 89.It Fl h Ar host 90.Ar Host 91names may be names or internet numbers. 92.It Fl L Ar linesize 93Use the provided linesize as the width to format the tty field. 94.It Fl N Ar namesize 95Use the provided namesize as the width to format the login name field. 96.It Fl n 97Print host addresses numerically. 98This option works only on 99.Xr wtmpx 5 100entries, 101and prints nothing on 102.Xr wtmp 5 103entries. 104.It Fl T 105Display better time information, including the year and seconds. 106.It Fl t Ar tty 107Specify the 108.Ar tty . 109Tty names may be given fully or abbreviated, for example, 110.Dq Li "last -t 03" 111is equivalent to 112.Dq Li "last -t tty03" . 113.It Fl x 114Assume that the file given is 115.Xr wtmpx 5 116format, even if the filename does not end with an 117.Sq x . 118.El 119.Pp 120If multiple arguments are given, the information which applies to any of the 121arguments is printed, e.g., 122.Dq Li "last root -t console" 123would list all of 124.Dq Li root Ns 's 125sessions as well as all sessions on the console terminal. 126If no users, hostnames, or terminals are specified, 127.Nm 128prints a record of all logins and logouts. 129.Pp 130The pseudo-user 131.Ar reboot 132logs in at reboots of the system, thus 133.Dq Li last reboot 134will give an indication of mean time between reboot. 135.Pp 136If 137.Nm 138is interrupted, it indicates to what date the search has progressed. 139If interrupted with a quit signal 140.Nm 141indicates how far the search has progressed and then continues. 142.Sh FILES 143.Bl -tag -width /var/log/wtmpx -compact 144.It Pa /var/log/wtmp 145login data base 146.It Pa /var/log/wtmpx 147login data base 148.El 149.Sh SEE ALSO 150.Xr lastcomm 1 , 151.Xr utmp 5 , 152.Xr utmpx 5 , 153.Xr ac 8 , 154.Xr lastlogin 8 155.Sh HISTORY 156.Nm 157appeared in 158.Bx 3.0 . 159