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

NAME

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

SYNOPSIS

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

DESCRIPTION

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

OPTIONS

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

TIME FORMATS

88       The options that take the time argument understand the following
89       formats:
90
91       ┌────────────────────┬───────────────────────────┐
92       │                    │                           │
93       │YYYYMMDDhhmmss      │                           │
94       ├────────────────────┼───────────────────────────┤
95       │                    │                           │
96       │YYYY-MM-DD hh:mm:ss │                           │
97       ├────────────────────┼───────────────────────────┤
98       │                    │                           │
99       │YYYY-MM-DD hh:mm    │ (seconds will be set to   │
100       │                    │ 00)                       │
101       ├────────────────────┼───────────────────────────┤
102       │                    │                           │
103       │YYYY-MM-DD          │ (time will be set to      │
104       │                    │ 00:00:00)                 │
105       ├────────────────────┼───────────────────────────┤
106       │                    │                           │
107       │hh:mm:ss            │ (date will be set to      │
108       │                    │ today)                    │
109       ├────────────────────┼───────────────────────────┤
110       │                    │                           │
111       │hh:mm               │ (date will be set to      │
112       │                    │ today, seconds to 00)     │
113       ├────────────────────┼───────────────────────────┤
114       │                    │                           │
115       │now                 │                           │
116       ├────────────────────┼───────────────────────────┤
117       │                    │                           │
118       │yesterday           │ (time is set to 00:00:00) │
119       ├────────────────────┼───────────────────────────┤
120       │                    │                           │
121       │today               │ (time is set to 00:00:00) │
122       ├────────────────────┼───────────────────────────┤
123       │                    │                           │
124       │tomorrow            │ (time is set to 00:00:00) │
125       ├────────────────────┼───────────────────────────┤
126       │                    │                           │
127       │+5min               │                           │
128       ├────────────────────┼───────────────────────────┤
129       │                    │                           │
130       │-5days              │                           │
131       └────────────────────┴───────────────────────────┘
132

FILES

134       /var/log/wtmp, /var/log/btmp
135

NOTES

137       The files wtmp and btmp might not be found. The system only logs
138       information in these files if they are present. This is a local
139       configuration issue. If you want the files to be used, they can be
140       created with a simple touch(1) command (for example, touch
141       /var/log/wtmp).
142

AUTHORS

144       Miquel van Smoorenburg <miquels@cistron.nl>
145

SEE ALSO

147       login(1), wtmp(5), init(8), shutdown(8)
148

REPORTING BUGS

150       For bug reports, use the issue tracker at
151       https://github.com/karelzak/util-linux/issues.
152

AVAILABILITY

154       The last command is part of the util-linux package which can be
155       downloaded from Linux Kernel Archive
156       <https://www.kernel.org/pub/linux/utils/util-linux/>.
157
158
159
160util-linux 2.37.2                 2021-06-02                           LAST(1)
Impressum