1.\" $OpenBSD: last.1,v 1.26 2007/05/31 19:20:11 jmc Exp $ 2.\" $NetBSD: last.1,v 1.3 1994/12/21 22:41:23 jtc Exp $ 3.\" 4.\" Copyright (c) 1980, 1990, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)last.1 8.1 (Berkeley) 6/6/93 32.\" 33.Dd $Mdocdate: May 31 2007 $ 34.Dt LAST 1 35.Os 36.Sh NAME 37.Nm last 38.Nd indicate last logins of users, ttys, and hosts 39.Sh SYNOPSIS 40.Nm last 41.Op Fl csT 42.Op Fl d Ar date 43.Op Fl f Ar file 44.Op Fl h Ar host 45.Op Fl n Ar number 46.Op Fl t Ar tty 47.Op Ar user ... 48.Sh DESCRIPTION 49The 50.Nm 51utility will either list the sessions of specified 52.Ar users , 53.Ar ttys , 54and 55.Ar hosts , 56in reverse time order, 57or list the users logged in at a specified snapshot date and time 58in reverse time order. 59Each line of output contains 60the user name, the tty from which the session was conducted, any 61hostname, the start and stop times for the session, and the duration 62of the session. 63If the session is still continuing or was cut short by 64a crash or shutdown, 65.Nm 66will so indicate. 67.Pp 68The options are as follows: 69.Bl -tag -width "-n number" 70.It Fl c 71Calculates the total time displayed and prints it after the output. 72.It Fl d Ar date 73Specify the snapshot date and time. 74All users logged in at the snapshot date and time will 75be reported. 76This may be used with the 77.Fl f 78option to derive the results from stored wtmp files. 79When this argument is provided, all other options except for 80.Fl f 81and 82.Fl n 83are ignored. 84The argument should be in the form 85.Dq [[[CC]YY]MMDD]hhmm[.SS] 86where each pair of letters represents the following: 87.Pp 88.Bl -tag -width Ds -compact -offset indent 89.It Ar CC 90The first two digits of the year (the century). 91.It Ar YY 92The second two digits of the year. 93If 94.Dq YY 95is specified, but 96.Dq CC 97is not, a value for 98.Dq YY 99between 69 and 99 results in a 100.Dq CC 101value of 19. 102Otherwise, a 103.Dq CC 104value of 20 is used. 105.It Ar MM 106Month of the year, from 1 to 12. 107.It Ar DD 108Day of the month, from 1 to 31. 109.It Ar hh 110Hour of the day, from 0 to 23. 111.It Ar mm 112Minute of the hour, from 0 to 59. 113.It Ar SS 114Second of the minute, from 0 to 61. 115.El 116.Pp 117All but the 118.Dq hh 119and 120.Dq mm 121letter pairs are optional. 122If the 123.Dq CC 124and 125.Dq YY 126letter pairs are not specified, the values default to the current 127year. 128If the 129.Dq MM 130and 131.Dq DD 132letter pairs are not specified, the values default to the current 133month and day. 134If the 135.Dq SS 136letter pair is not specified, the value defaults to 0. 137.It Fl f Ar file 138.Nm 139reads the file 140.Ar file 141instead of the default, 142.Pa /var/log/wtmp . 143.It Fl h Ar host 144.Ar host 145names may be names or internet numbers. 146.It Fl n Ar number 147Limits the report to 148.Ar number 149lines. 150The format 151.Fl Ns Ar number 152is also supported, 153but is deprecated. 154.It Fl s 155Display time values in seconds since the Epoch, instead of formatted dates. 156.It Fl T 157Display better time information, including seconds. 158.It Fl t Ar tty 159Specify the 160.Ar tty . 161tty names may be given fully or abbreviated, for example, 162.Ic last -t 03 163is 164equivalent to 165.Ic last -t tty03 . 166.El 167.Pp 168If 169multiple arguments are given, and a snapshot time is not specified, the 170information which applies to any of the 171arguments is printed, e.g., 172.Ic last root -t console 173would list all of 174.Li root Ns 's 175sessions as well as all sessions on the console terminal. 176If no users, hostnames, or terminals are specified, 177.Nm 178prints a record of 179all logins and logouts. 180.Pp 181The pseudo-user 182.Dq reboot 183logs in at reboots of the system; thus 184.Ic last reboot 185will give an indication of mean time between reboot. 186.Pp 187If 188.Nm 189is interrupted, it indicates to what date the search has 190progressed. 191If interrupted with a quit signal, 192.Nm 193indicates how 194far the search has progressed and then continues. 195.Sh FILES 196.Bl -tag -width /var/log/wtmp -compact 197.It Pa /var/log/wtmp 198login database 199.El 200.Sh SEE ALSO 201.Xr lastcomm 1 , 202.Xr utmp 5 , 203.Xr ac 8 204.Sh HISTORY 205The 206.Nm 207command appeared in 208.Bx 3.0 . 209