Name

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

Synopsis

last [options] [users]

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

last
dan  ttys003  example.com  Mon Sep 8 21:07 - 21:08 (00:01)
lisa console               Mon Sep 8 20:25 - 20:56 (00:31)
dan  ttys001  example.com  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.

-t tty

Print entries only for the given tty name, such as ttys001.

Get Macintosh Terminal 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.