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 May 2, 2001 36.Dt LAST 1 37.Os 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.Oo 45.Fl d 46.Sm off 47.Op Oo Ar CC Oc Ar YY 48.Op Ar MM DD 49.Ar hh mm 50.Op Ar .SS 51.Sm on 52.Oc 53.Op Fl f Ar file 54.Op Fl h Ar host 55.Op Fl s 56.Op Fl t Ar tty 57.Op Fl w 58.Op Ar user ... 59.Sh DESCRIPTION 60.Nm Last 61will either list the sessions of specified 62.Ar users , 63.Ar ttys , 64and 65.Ar hosts , 66in reverse time order, 67or list the users logged in at a specified date and time. 68Each line of output contains 69the user name, the tty from which the session was conducted, any 70hostname, the start and stop times for the session, and the duration 71of the session. 72If the session is still continuing or was cut short by 73a crash or shutdown, 74.Nm 75will so indicate. 76.Pp 77.Bl -tag -width indent-two 78.It Fl Ar n 79Limits the report to 80.Ar n 81lines. 82.It Fl d Ar date 83Specify the snapshot date and time. 84All users logged in at the snapshot date and time will 85be reported. 86This may be used with the 87.Fl f 88option to derive the results from stored wtmp files. 89When this argument is provided, all other options except for 90.Fl f 91and 92.Fl Ar n 93are ignored. 94The argument should be in the form 95.Sm off 96.Op Oo Ar CC Oc Ar YY 97.Op Ar MM DD 98.Ar hh mm 99.Op Ar .SS 100.Sm on 101where each pair of letters represents the following: 102.Pp 103.Bl -tag -width Ds -compact -offset indent 104.It Ar CC 105The first two digits of the year (the century). 106.It Ar YY 107The second two digits of the year. 108If 109.Ar YY 110is specified, but 111.Ar CC 112is not, a value for 113.Ar YY 114between 69 and 99 results in a 115.Ar CC 116value of 19. 117Otherwise, a 118.Ar CC 119value of 20 is used. 120.It Ar MM 121Month of the year, from 1 to 12. 122.It Ar DD 123Day of the month, from 1 to 31. 124.It Ar hh 125Hour of the day, from 0 to 23. 126.It Ar mm 127Minute of the hour, from 0 to 59. 128.It Ar SS 129Second of the minute, from 0 to 61. 130.El 131.Pp 132If the 133.Ar CC 134and 135.Ar YY 136letter pairs are not specified, the values default to the current 137year. 138If the 139.Ar SS 140letter pair is not specified, the value defaults to 0. 141.It Fl f Ar file 142.Nm Last 143reads the file 144.Ar file 145instead of the default, 146.Pa /var/log/wtmp . 147.It Fl h Ar host 148.Ar Host 149names may be names or internet numbers. 150.It Fl s 151Report the duration of the login session in seconds, instead of the 152default days, hours and minutes. 153.It Fl t Ar tty 154Specify the 155.Ar tty . 156Tty names may be given fully or abbreviated, for example, 157.Dq Li "last -t 03" 158is 159equivalent to 160.Dq Li "last -t tty03" . 161.It Fl w 162Widen the duration field to show seconds, as well as the 163default days, hours and minutes. 164.El 165.Pp 166If multiple arguments are given, 167and a snapshot time is not specified, 168the information which applies to any of the 169arguments is printed, e.g., 170.Dq Li "last root -t console" 171would list all of 172.Dq Li root Ns 's 173sessions as well as all sessions on the console terminal. 174If no 175users, hostnames or terminals are specified, 176.Nm 177prints a record of 178all logins and logouts. 179.Pp 180The pseudo-user 181.Ar reboot 182logs in at reboots of the system, thus 183.Dq Li last reboot 184will give an indication of mean time between reboot. 185.Pp 186If 187.Nm 188is interrupted, it indicates to what date the search has 189progressed. 190If interrupted with a quit signal 191.Nm 192indicates how 193far the search has progressed and then continues. 194.Sh FILES 195.Bl -tag -width /var/log/wtmp -compact 196.It Pa /var/log/wtmp 197login data base 198.El 199.Sh SEE ALSO 200.Xr lastcomm 1 , 201.Xr utmp 5 , 202.Xr ac 8 203.Sh BUGS 204If a login shell should terminate abnormally for some reason, it is likely 205that a logout record won't be written to the wtmp file. 206In this case, 207.Nm 208will indicate the logout time as "shutdown". 209.Sh HISTORY 210.Nm Last 211appeared in 212.Bx 3.0 . 213