If you want to audit, when your Mac (Macbook/iMac/Mac Studio/Mini) was last logged in, rebooted, or shut down, you can make use of the last command on the Terminal app. It will give a record of all such details.
Example:Macbook % last
code2care ttys001 Thu Sep 14 10:58 still logged in
code2care ttys000 Thu Sep 14 10:58 still logged in
code2care console Thu Sep 14 10:58 still logged in
reboot time Thu Sep 14 10:57
shutdown time Thu Sep 14 00:31
code2care ttys001 Wed Sep 13 13:26 - 13:26 (00:00)
code2care ttys000 Wed Sep 13 13:25 - 13:25 (00:00)
code2care console Tue Sep 12 09:59 - 00:31 (1+14:31)
reboot time Tue Sep 12 09:58
shutdown time Tue Sep 12 01:22
code2care ttys000 Sun Sep 10 11:23 - 11:23 (00:00)
code2care ttys000 Sun Sep 10 10:46 - 10:46 (00:00)
code2care console Sat Sep 9 20:03 - 01:22 (2+05:18)
_mbsetupuser console Sat Sep 9 20:00 - 20:03 (00:03)
root console Sat Sep 9 20:00 - 20:00 (00:00)
reboot time Sat Sep 9 19:59
You can filter this information by piping this command with grep.
List of all recent Mac Shutdowns
Macbook % last | grep 'shutdown'
shutdown time Thu Sep 14 00:31
shutdown time Tue Sep 12 01:22
List of all recent Mac Reboots
Macbook % last | grep 'reboot'
reboot time Thu Sep 14 10:57
reboot time Tue Sep 12 09:58
reboot time Sat Sep 9 19:59
List of all recent Mac Logins
Macbook % last | grep 'logged'
code2care ttys001 Thu Sep 14 10:58 still logged in
code2care ttys000 Thu Sep 14 10:58 still logged in
code2care console Thu Sep 14 10:58 still logged in
Facing issues? Have Questions? Post them here! I am happy to answer!
Author Info:
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
More Posts related to MacOS,
- How to show line numbers in Nano on Mac
- How to install Jupyter Notebook on macOS Sonoma
- How to Disable Remote Management using Mac Terminal
- Test internet speed using macOS Terminal command
- Docker Desktop needs privileged access macOS
- Google Search Hot Trends Screensaver for Mac OS X
- How to do calculations in Mac Terminal
- How to make TextEdit the default text Editor on Mac
- How to Show Full Website Address on Safari for Mac (Ventura/Sonoma)
- The Zsh Shell - Mac Tutorial
- Opening mac Terminal
- How to change the name of your Mac running on macOS Ventura 13
- How to find the Battery Cycle Count on macOS Ventura
- How to set an emoji as Zsh terminal prompt in macOS
- How to access Trash Folder using Mac Terminal Command
- macOS Ventura XCode Command Line Tools Installation
- Hide Bluetooth icon on Mac Menu Bar macOS Ventura 13
- How to run .sh file in Mac Terminal
- Terminal Command to get the list of available shells in macOS
- How to see Storage Information on macOS Ventura
- How to Go To /usr/local/bin on Mac Terminal?
- How to do screen recording on Mac
- How to Find File and Directory Size in Mac Terminal
- Open .bash_profile File in TextEdit using Terminal
- Remove Now Playing icon from macOS Big Sur Menu Bar
More Posts:
- 10 Must Know CSS Border Styles with Examples - CSS
- How to Change Mac Password on macOS Ventura - MacOS
- How to Access Local Files in Google Colab - Google
- Fix: EOFError Exception in Python - Python
- How to use a different Python version with virtualenv - Python
- Get HTML table td, tr or th inner content value with id or name attribute - Html
- Transfer files between Android and Mac OS X using usb cable - Mac-OS-X
- [Fix] Cannot connect to Microsoft SQL Server, Error: 18456 - Microsoft