1.\"	$NetBSD: lastlogin.8,v 1.14 2020/05/07 12:52:26 wiz Exp $
2.\"
3.\" Copyright (c) 1996 John M. Vinopal
4.\" 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. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed for the NetBSD Project
17.\"	by John M. Vinopal.
18.\" 4. The name of the author may not be used to endorse or promote products
19.\"    derived from this software without specific prior written permission.
20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
32.\"
33.Dd May 6, 2020
34.Dt LASTLOGIN 8
35.Os
36.Sh NAME
37.Nm lastlogin
38.Nd indicate last login time of users
39.Sh SYNOPSIS
40.Nm
41.Op Fl Fnrt
42.Op Fl f Ar filename
43.Op Fl H Ar hostsize
44.Op Fl L Ar linesize
45.Op Fl N Ar namesize
46.Op user ...
47.Sh DESCRIPTION
48.Nm
49will list the last login session of specified
50.Ar users ,
51or for all users by default.
52Each line of output contains the user name, the tty from which the
53session was conducted, any hostname, and the start time for the
54session.
55.Pp
56If multiple
57.Ar users
58are given, the session information for each user is printed in
59the order given on the command line.
60Otherwise, information for all users is printed, sorted by uid.
61.Pp
62.Nm
63differs from
64.Xr last 1
65in that it only prints information regarding the very last login session.
66The last login database is never turned over or deleted in standard usage.
67.Pp
68The following options are available:
69.Bl -tag -width indent
70.It Fl F
71Use fixed widths for all output fields.
72.It Fl f Ar filename
73Process input from
74.Ar filename .
75If the file ends with an
76.Dq x ,
77then it is assumed that it is a
78.Xr lastlogx 5
79file, else it is assumed to be a
80.Xr lastlog 5
81file.
82.It Fl H Ar hostlen
83Set the field width for host output to
84.Ar hostlen
85characters.
86.It Fl L Ar linelen
87Set the field width for line output to
88.Ar linelen
89characters.
90.It Fl N Ar namelen
91Set the field width for name output to
92.Ar namelen
93characters.
94.It Fl n
95Attempt to print numeric host addresses.
96This option is only supported with
97.Xr lastlogx 5
98format files.
99.It Fl r
100Reverse the order of the sort.
101.It Fl t
102Sort by last login time (most recent first.)
103.El
104.Sh FILES
105.Bl -tag -width /var/log/lastlogx -compact
106.It Pa /var/log/lastlogx
107default last login database
108.It Pa /var/log/lastlog
109compatibility last login database
110.El
111.Sh EXAMPLES
112.Nm
113looks by default to the
114.Pa /var/log/lastlogx
115database, where some old programs that are not
116.Xr utmpx 5
117aware might only write to
118.Pa /var/log/lastlog .
119To look at the old database one can use:
120.Pp
121.Dl lastlogin -f /var/log/lastlog
122.Sh SEE ALSO
123.Xr last 1 ,
124.Xr lastlog 5 ,
125.Xr lastlogx 5 ,
126.Xr ac 8
127.Sh AUTHORS
128.An John M. Vinopal
129wrote this program in January 1996 and contributed it to the
130.Nx
131project.
132