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