1LAST, LASTB(1)                   User Commands                  LAST, LASTB(1)
2
3
4

NAME

6       last, lastb - show a listing of last logged in users
7

SYNOPSIS

9       last [options] [username...] [tty...]
10       lastb [options] [username...] [tty...]
11

DESCRIPTION

13       last  searches  back through the /var/log/wtmp file (or the file desig‐
14       nated by the -f option) and displays a list of all users logged in (and
15       out)  since  that  file was created.  One or more usernames and/or ttys
16       can be given, in which case last will show only  the  entries  matching
17       those  arguments.  Names of ttys can be abbreviated, thus last 0 is the
18       same as last tty0.
19
20       When catching a SIGINT signal (generated by the interrupt key,  usually
21       control-C)  or a SIGQUIT signal, last will show how far it has searched
22       through the file; in the case of the SIGINT signal last will then  ter‐
23       minate.
24
25       The  pseudo user reboot logs in each time the system is rebooted.  Thus
26       last reboot will show a log of all the reboots since the log  file  was
27       created.
28
29       lastb is the same as last, except that by default it shows a log of the
30       /var/log/btmp file, which contains all the bad login attempts.
31

OPTIONS

33       -a, --hostlast
34              Display the hostname in the last column.  Useful in  combination
35              with the --dns option.
36
37       -d, --dns
38              For non-local logins, Linux stores not only the host name of the
39              remote host, but its IP number as well.  This option  translates
40              the IP number back into a hostname.
41
42       -f, --file file
43              Tell  last to use a specific file instead of /var/log/wtmp.  The
44              --file option can be given multiple times, and all of the speci‐
45              fied files will be processed.
46
47       -F, --fulltimes
48              Print full login and logout times and dates.
49
50       -i, --ip
51              Like  --dns  ,  but displays the host's IP number instead of the
52              name.
53
54       -number
55       -n, --limit number
56              Tell last how many lines to show.
57
58       -p, --present time
59              Display the users who were present at the specified time.   This
60              is  like using the options --since and --until together with the
61              same time.
62
63       -R, --nohostname
64              Suppresses the display of the hostname field.
65
66       -s, --since time
67              Display the state of logins since the specified time.   This  is
68              useful, e.g., to easily determine who was logged in at a partic‐
69              ular time.  The option is often combined with --until.
70
71       -t, --until time
72              Display the state of logins until the specified time.
73
74       --time-format format
75              Define the output timestamp format to be one of  notime,  short,
76              full,  or iso.  The notime variant will not print any timestamps
77              at all, short is the default,  and  full  is  the  same  as  the
78              --fulltimes  option.  The iso variant will display the timestamp
79              in ISO-8601 format.  The ISO format contains  timezone  informa‐
80              tion,  making it preferable when printouts are investigated out‐
81              side of the system.
82
83       -w, --fullnames
84              Display full user names and domain names in the output.
85
86       -x, --system
87              Display the system shutdown entries and run level changes.
88

TIME FORMATS

90       The options that take the time argument understand the  following  for‐
91       mats:
92
93       YYYYMMDDhhmmss
94       YYYY-MM-DD hh:mm:ss
95       YYYY-MM-DD hh:mm     (seconds will be set to 00)
96       YYYY-MM-DD           (time will be set to 00:00:00)
97       hh:mm:ss             (date will be set to today)
98       hh:mm                (date will be set to today, seconds to 00)
99       now
100       yesterday            (time is set to 00:00:00)
101       today                (time is set to 00:00:00)
102       tomorrow             (time is set to 00:00:00)
103       +5min
104       -5days
105

FILES

107       /var/log/wtmp
108       /var/log/btmp
109

NOTES

111       The  files  wtmp  and  btmp  might  not be found.  The system only logs
112       information in these files if they are present.  This is a  local  con‐
113       figuration  issue.   If you want the files to be used, they can be cre‐
114       ated with a simple touch(1) command (for example, touch /var/log/wtmp).
115

AUTHORS

117       Miquel van Smoorenburg ⟨miquels@cistron.nl⟩
118

SEE ALSO

120       login(1), wtmp(5), init(8), shutdown(8)
121

AVAILABILITY

123       The last command is part of the util-linux  package  and  is  available
124       from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
125       linux/⟩.
126
127
128
129util-linux                       October 2013                   LAST, LASTB(1)
Impressum