1 <?xml version="1.0" encoding="UTF-8"?>
3 Copyright (c) 1992 , Julianne Frances Haugh
4 Copyright (c) 1992 , Phillip Street
5 Copyright (c) 2007 - 2009, Nicolas François
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions
11 1. Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer.
13 2. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution.
16 3. The name of the copyright holders or contributors may not be used to
17 endorse or promote products derived from this software without
18 specific prior written permission.
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 <refentry id='lastlog.8'>
35 <refentrytitle>lastlog</refentrytitle>
36 <manvolnum>8</manvolnum>
37 <refmiscinfo class="sectdesc">System Management Commands</refmiscinfo>
39 <refnamediv id='name'>
40 <refname>lastlog</refname>
41 <refpurpose>reports the most recent login of all users or of a given user</refpurpose>
43 <!-- body begins here -->
44 <refsynopsisdiv id='synopsis'>
46 <command>lastlog</command>
48 <replaceable>options</replaceable>
53 <refsect1 id='description'>
54 <title>DESCRIPTION</title>
56 <command>lastlog</command> formats and prints the contents of the last
57 login log <filename>/var/log/lastlog</filename> file. The
58 <emphasis>login-name</emphasis>, <emphasis>port</emphasis>, and
59 <emphasis>last login time</emphasis> will be printed. The default (no
60 flags) causes lastlog entries to be printed, sorted by their order in
61 <filename>/etc/passwd</filename>.
65 <refsect1 id='options'>
66 <title>OPTIONS</title>
68 The options which apply to the <command>lastlog</command> command are:
70 <variablelist remap='IP'>
73 <option>-b</option>, <option>--before</option> <replaceable>DAYS</replaceable>
77 Print only lastlog records older than <emphasis remap='I'>DAYS</emphasis>.
83 <option>-h</option>, <option>--help</option>
86 <para>Display help message and exit.</para>
91 <option>-t</option>, <option>--time</option>
92 <replaceable>DAYS</replaceable>
96 Print the lastlog records more recent than
97 <emphasis remap='I'>DAYS</emphasis>.
103 <option>-u</option>, <option>--user</option>
104 <replaceable>LOGIN</replaceable>|<replaceable>RANGE</replaceable>
108 Print the lastlog record of the specified user(s).
111 The users can be specified by a login name, a numerical user ID,
112 or a <replaceable>RANGE</replaceable> of users. This
113 <replaceable>RANGE</replaceable> of users can be specified with a
114 min and max values (<replaceable>UID_MIN-UID_MAX</replaceable>), a
115 max value (<replaceable>-UID_MAX</replaceable>), or a min value
116 (<replaceable>UID_MIN-</replaceable>).
123 If the user has never logged in the message <emphasis>** Never logged
124 in**</emphasis> will be displayed instead of the port and time.
128 Only the entries for the current users of the system will be
129 displayed. Other entries may exist for users that were deleted
137 The <filename>lastlog</filename> file is a database which contains info
138 on the last login of each user. You should not rotate it. It is a sparse
139 file, so its size on the disk is usually much smaller than the one shown
140 by "<command>ls -l</command>" (which can indicate a really big file if
141 you have in <filename>passwd</filename> users with a high UID). You can
142 display its real size with "<command>ls -s</command>".
146 <refsect1 id='files'>
150 <term><filename>/var/log/lastlog</filename></term>
152 <para>Database times of previous user logins.</para>
158 <refsect1 id='caveats'>
159 <title>CAVEATS</title>
161 Large gaps in UID numbers will cause the lastlog program to run
162 longer with no output to the screen (i.e. if in lastlog database there
163 is no entries for users with UID between 170 and 800 lastlog will appear
164 to hang as it processes entries with UIDs 171-799).