302 lines
6.6 KiB
HTML
302 lines
6.6 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of LAST, LASTB</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>LAST, LASTB</H1>
|
|
Section: User Commands (1)<BR>Updated: October 2013<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
last, lastb - show a listing of last logged in users
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>last</B>
|
|
|
|
[options]
|
|
[<I>username</I>...] [<I>tty</I>...]
|
|
|
|
<BR>
|
|
|
|
<B>lastb</B>
|
|
|
|
[options]
|
|
[<I>username</I>...] [<I>tty</I>...]
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>last</B>
|
|
|
|
searches back through the
|
|
<I>/var/log/wtmp</I>
|
|
|
|
file (or the file designated by the
|
|
<B>-f</B>
|
|
|
|
option) and displays a list of all users logged in (and out) since that
|
|
file was created. One or more
|
|
<I>usernames</I> and/or <I>ttys</I>
|
|
|
|
can be given, in which case
|
|
<B>last</B>
|
|
|
|
will show only the entries matching those arguments. Names of
|
|
<I>ttys</I>
|
|
|
|
can be abbreviated, thus
|
|
<B>last 0</B>
|
|
|
|
is the same as
|
|
<B>last tty0</B>.
|
|
|
|
<P>
|
|
|
|
When catching a SIGINT signal (generated by the interrupt key, usually
|
|
control-C) or a SIGQUIT signal,
|
|
<B>last</B>
|
|
|
|
will show how far it has searched through the file; in the case of the
|
|
SIGINT signal
|
|
<B>last</B>
|
|
|
|
will then terminate.
|
|
<P>
|
|
|
|
The pseudo user
|
|
<B>reboot</B>
|
|
|
|
logs in each time the system is rebooted. Thus
|
|
<B>last reboot</B>
|
|
|
|
will show a log of all the reboots since the log file was created.
|
|
<P>
|
|
|
|
<B>lastb</B>
|
|
|
|
is the same as
|
|
<B>last</B>,
|
|
|
|
except that by default it shows a log of the
|
|
<I>/var/log/btmp</I>
|
|
|
|
file, which contains all the bad login attempts.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-a</B>,<B> --hostlast</B>
|
|
|
|
<DD>
|
|
Display the hostname in the last column. Useful in combination with the
|
|
<B>--dns</B>
|
|
|
|
option.
|
|
<DT id="2"><B>-d</B>,<B> --dns</B>
|
|
|
|
<DD>
|
|
For non-local logins, Linux stores not only the host name of the remote
|
|
host, but its IP number as well. This option translates the IP number
|
|
back into a hostname.
|
|
<DT id="3"><B>-f</B>,<B> --file </B><I>file</I>
|
|
|
|
<DD>
|
|
Tell
|
|
<B>last</B>
|
|
|
|
to use a specific <I>file</I> instead of
|
|
<I>/var/log/wtmp</I>.
|
|
|
|
The
|
|
<B>--file</B>
|
|
|
|
option can be given multiple times, and all of the specified files will be
|
|
processed.
|
|
<DT id="4"><B>-F</B>,<B> --fulltimes</B>
|
|
|
|
<DD>
|
|
Print full login and logout times and dates.
|
|
<DT id="5"><B>-i</B>,<B> --ip</B>
|
|
|
|
<DD>
|
|
Like
|
|
<B>--dns ,</B>
|
|
|
|
but displays the host's IP number instead of the name.
|
|
<DT id="6"><B>-</B><I>number</I>
|
|
|
|
<DD>
|
|
|
|
<B>-n</B>,<B> --limit </B><I>number</I>
|
|
|
|
Tell
|
|
<B>last</B>
|
|
|
|
how many lines to show.
|
|
<DT id="7"><B>-p</B>,<B> --present </B><I>time</I>
|
|
|
|
<DD>
|
|
Display the users who were present at the specified time. This is
|
|
like using the options
|
|
<B>--since</B> and <B>--until</B>
|
|
|
|
together with the same <I>time</I>.
|
|
<DT id="8"><B>-R</B>,<B> --nohostname</B>
|
|
|
|
<DD>
|
|
Suppresses the display of the hostname field.
|
|
<DT id="9"><B>-s</B>,<B> --since </B><I>time</I>
|
|
|
|
<DD>
|
|
Display the state of logins since the specified
|
|
<I>time</I>.
|
|
|
|
This is useful, e.g., to easily determine who was logged in at a
|
|
particular time. The option is often combined with
|
|
<B>--until</B>.
|
|
|
|
<DT id="10"><B>-t</B>,<B> --until </B><I>time</I>
|
|
|
|
<DD>
|
|
Display the state of logins until the specified
|
|
<I>time</I>.
|
|
|
|
<DT id="11"><B>--time-format</B><I> format</I>
|
|
|
|
<DD>
|
|
Define the output timestamp
|
|
<I>format</I>
|
|
|
|
to be one of
|
|
<I>notime</I>,
|
|
|
|
<I>short</I>,
|
|
|
|
<I>full</I>,
|
|
|
|
or
|
|
<I>iso</I>.
|
|
|
|
The
|
|
<I>notime</I>
|
|
|
|
variant will not print any timestamps at all,
|
|
<I>short</I>
|
|
|
|
is the default, and
|
|
<I>full</I>
|
|
|
|
is the same as the
|
|
<B>--fulltimes</B>
|
|
|
|
option. The
|
|
<I>iso</I>
|
|
|
|
variant will display the timestamp in ISO-8601 format. The ISO format
|
|
contains timezone information, making it preferable when printouts are
|
|
investigated outside of the system.
|
|
<DT id="12"><B>-w</B>,<B> --fullnames</B>
|
|
|
|
<DD>
|
|
Display full user names and domain names in the output.
|
|
<DT id="13"><B>-x</B>,<B> --system</B>
|
|
|
|
<DD>
|
|
Display the system shutdown entries and run level changes.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>TIME FORMATS</H2>
|
|
|
|
The options that take the
|
|
<I>time</I>
|
|
|
|
argument understand the following formats:
|
|
<TABLE>
|
|
<TR VALIGN=top><TD>YYYYMMDDhhmmss </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>YYYY-MM-DD hh:mm:ss </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>YYYY-MM-DD hh:mm </TD><TD>(seconds will be set to 00)<BR></TD></TR>
|
|
<TR VALIGN=top><TD>YYYY-MM-DD </TD><TD>(time will be set to 00:00:00)<BR></TD></TR>
|
|
<TR VALIGN=top><TD>hh:mm:ss </TD><TD>(date will be set to today)<BR></TD></TR>
|
|
<TR VALIGN=top><TD>hh:mm </TD><TD>(date will be set to today, seconds to 00)<BR></TD></TR>
|
|
<TR VALIGN=top><TD>now </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>yesterday </TD><TD>(time is set to 00:00:00)<BR></TD></TR>
|
|
<TR VALIGN=top><TD>today </TD><TD>(time is set to 00:00:00)<BR></TD></TR>
|
|
<TR VALIGN=top><TD>tomorrow </TD><TD>(time is set to 00:00:00)<BR></TD></TR>
|
|
<TR VALIGN=top><TD>+5min </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>-5days </TD><TD><BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
The files
|
|
<I>wtmp</I>
|
|
|
|
and
|
|
<I>btmp</I>
|
|
|
|
might not be found. The system only logs information in these files if
|
|
they are present. This is a local configuration issue. If you want the
|
|
files to be used, they can be created with a simple
|
|
<B><A HREF="/cgi-bin/man/man2html?1+touch">touch</A></B>(1)
|
|
|
|
command (for example,
|
|
<I>touch /var/log/wtmp</I>).
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H2>FILES</H2>
|
|
|
|
/var/log/wtmp
|
|
<BR>
|
|
|
|
/var/log/btmp
|
|
<A NAME="lbAI"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
|
|
Miquel van Smoorenburg
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>AVAILABILITY</H2>
|
|
|
|
The last command is part of the util-linux package and is available from
|
|
|
|
Linux Kernel Archive
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+login">login</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+wtmp">wtmp</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+init">init</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+shutdown">shutdown</A></B>(8)
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="14"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="15"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="16"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="17"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="18"><A HREF="#lbAF">TIME FORMATS</A><DD>
|
|
<DT id="19"><A HREF="#lbAG">NOTES</A><DD>
|
|
<DT id="20"><A HREF="#lbAH">FILES</A><DD>
|
|
<DT id="21"><A HREF="#lbAI">AUTHOR</A><DD>
|
|
<DT id="22"><A HREF="#lbAJ">AVAILABILITY</A><DD>
|
|
<DT id="23"><A HREF="#lbAK">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:17 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|