Skip to main content

Linux Tips: Uptime

Linux Performance
By Keith Edmunds13 March 2018No Comments

Sometimes we just want it to be easier.

You find out that a server rebooted a few days ago, and you’d like to know why. It would be helpful to look at the logs just before the reboot, so let’s work out when it rebooted. The uptime command gives hints:

$ uptime
 13:24:52 up 2 days,  19:42,  6 users,  load average: 0.86, 0.97, 0.80

It’s been up for 2 days, 19 hours and 42 minutes, and it’s now 13:24, so it must have rebooted, er, hang on…

Trying that calculation with insufficient coffee is daunting – but there’s an easy fix. The uptime command has a --since option:

$ uptime --since
2018-03-03 17:42:57

How fabulous is that? How many times have you tried to do 24-hour arithmetic in your head to work out when a system booted?

Was This Helpful?

Let us know in the comments below.