O'Reilly logo

Linux Pocket Guide, 2nd Edition by Daniel J. Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

last — stdin  stdout  - file  -- opt  --help  --version

Synopsis

last [options] [users] [ttys]

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/wtmp; see the who command for more details.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required