OSX Uptime – How to Check How Long the System Has Been Awake or Running

laptoposxuptime

First and foremost I want to know how long my laptop (unix, apple, OSX 10.9 mavericks) has been 'awake' (i.e. how long its been open, or since it last 'slept'). I' also be interested in how long since the last restart, and time since the last shutdown (if those two things can be differentiated). I've tried the who and w commands, which seem to show me time for the whole system, and for individual processes (terminals?) since the system last restarted.

Is there a way to tell how long the system has been awake, explicitly?
Does the reported process times include sleep-time (i.e. when my laptop is closed)?
Is there a way to distinguish between restart and shutdown?

Best Answer

Use uptime command. Yes, it includes sleep time, if you don't want to include it see:

There is no way to distinguish between restart and shutdown, without parsing logs.

Related Question