How to show uptime and reboot history on your Mac the command line

Hexley_the_Platypus.svgUsually 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.

Reboot History

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:





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.