24

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.

Giacomo1968
  • 58,727

3 Answers3

26

The venerable Unix utility for viewing previous logins is last.

See man last

Spiff
  • 110,156
24

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

DarkSatyr
  • 341
10

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.

Shawn Geddes
  • 101
  • 1
  • 2