How to show uptime and reboot history on your Mac the command line
Usually the top command shows you how long a Linux system is up and running – but sadly not on OS X, or Darwin more specifically.
There is however a command line tool with the descriptive name uptime which will tell you how long your Mac has been running, precisely the line that’s missing from top on OS X:
uptime 14:37 up 14 days, 38 mins, 4 users, load averages: 1.39 1.42 1.38
If you have the OS X Server App installed, it will show you this value in the GUI on the Overview screen too.
Sometimes it’s also nice to know when your Mac was last rebooted, especially if it’s a remote system you don’t often get to talk to. There’s another handy command which will show you just that: last reboot:
last reboot reboot ~ Mon Feb 16 09:24 reboot ~ Sun Feb 15 09:07 reboot ~ Sat Feb 14 11:32 reboot ~ Fri Feb 13 09:27 reboot ~ Thu Feb 12 16:00 reboot ~ Wed Feb 11 17:23 reboot ~ Tue Feb 10 08:56 reboot ~ Sat Feb 7 12:29 reboot ~ Fri Feb 6 16:42 reboot ~ Fri Feb 6 16:22 reboot ~ Fri Feb 6 13:26 reboot ~ Fri Feb 6 11:04 wtmp begins Fri Feb 6 11:04
Further reading and kudos: