Name

last [options] [users] [ttys] — SysVinit

Synopsis

/usr/bin stdin stdout - file -- opt --help --version

The last command displays a history of logins, in reverse chronological order.

$ last
barrett pts/3  localhost Mon Sep 8 21:07 - 21:08 (00:01)
smith   pts/6  :0        Mon Sep 8 20:25 - 20:56 (00:31)
barrett pts/4  myhost    Sun Sep 7 22:19 still logged in
...

You may provide usernames or tty names to limit the output.

Useful options

-N

Print only the latest N lines of output, where N is a positive integer.

-i

Display IP addresses instead of hostnames.

-R

Don’t display hostnames.

-x

Also display system shutdowns and changes in system runlevel (e.g., from single-user mode into multiuser mode).

-f filename

Read from some other data file than /var/run/utmp; see the who command for more details.

Get Linux Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.