How can a I get the total uptime since boot (excluding the sleep time)?
I can use the uptime
command which shows how long since the last boot, but this does not differentiate between active use and sleep or hibernation.
macossleep-wake
How can a I get the total uptime since boot (excluding the sleep time)?
I can use the uptime
command which shows how long since the last boot, but this does not differentiate between active use and sleep or hibernation.
Best Answer
As far as I know there is no simple command executed in Terminal to get your desired result.
Here is an example for a workaround to get the uptime and the sleep time(s):
with date: dd/mm/yy (example: 23/07/15)
Example (10.9.5 Virtual Machine):
Now do the math and calculate the non-sleep uptime. (6540 secs - 108 secs = 6432 secs).
Depending on your operating system and the hibernation mode you set, you may have to alter the grep part in the above command. Check
pmset -g log
for the appropriate strings. You also may omit the ' Wake ' part of the command to simplfy the output.