View all login history on MacBook Pro running Mac OS X 10.6.8?

What command can I use in terminal to see login history? I think it's possible someone created a hidden account or booted the machine in safe mode.


Solution 1:

The venerable Unix utility for viewing previous logins is last.

See man last

Solution 2:

Checked on Mac OS Mojave 10.14.5

sudo log show --style syslog  --last 1d | awk '/Enter/ && /unlockUIBecomesActive/ {print $1 " " $2}'

1d - is a shortcut for a period back in time

Solution 3:

Here is how I did it.

To see your login history on your Mac:

  1. Open the "Terminal" app
  2. Type the word last followed by your username. For example, last johnsmith.
  3. A list of login activity for your user account will appear in reverse chronological order.

For folks unfamiliar with Terminal:

To open, you can quickly find it in the Spotlight Search (hourglass search icon at top-right of screen).

The process I described worked today for me. I am using OS X Yosemite (10.10.5). I haven't tested it with other Mac operating systems.