Do you remember the last time you restarted or shut down your Mac? Especially with MacBooks, many users have a habit of simply closing the lid of the laptop instead of shutting it down and then simply returning to it when needed. But your Mac will definitely benefit from shutting down or restarting it from time to time.
macOS offers native tools that can give you information about your computer's health status, recent restarts, and recent shutdowns—and they're fairly easy to access. You can then use this data to diagnose a wide variety of problems and error messages on your Mac, to troubleshoot random restarts, to contact tech support, or just to satisfy your curiosity.
Find out your Mac's uptime via System Information
Uptime is the amount of time your Mac has been up since it was last shut down or restarted. If the uptime is long, congratulations, you most likely have a problem-free computer. If your Mac experiences certain difficulties from time to time, you probably restart it to free up RAM or fix random glitches. You can find out the relevant information using the integrated tool called System information. You can start this tool from Spotlight, for example, when you enter an expression in the text field "System Information". In the left panel of the information window, click on Software, and you can find the relevant information in the main part of the window in the section Time since launch.
Finding Mac operating time via Terminal
The second option to find out the operating time of your Mac is to enter the appropriate command to Terminal. Over Finder -> Applications -> Utilities or run through Spotligth Terminal. Then type the command in the command line uptime and press Enter. You can also use this command to display the current system time, number of open Terminal windows and system load averages for the last 1, 5 and 15 minutes, which is an indicator of the utilization of system resources.
Finding out the history of Mac restarts and shutdowns via Terminal
The terminal can also be useful if you need to find out the history of restarts and shutdowns of your Mac. Start Terminal as usual and then enter the command at the command line last reboot, eventual last shutdown.