Knowing the uptime of a Linux machine, whether it is a server or laptop, can be very useful for aiding in troubleshooting. Windows machines usually have a stigma about being unstable and rebooting usually helps. However, the same can be true about Linux systems. While some Linux systems can utilize a service called “hot patching” to patch the kernel and other critical systems without a reboot, it’s still occasionally good to give Linux systems reboots.
Personally, I have seen it where there have been instances where starting and stopping a service on Linux didn’t reboot the service properly and it failed to work until a system reboot was issued. So knowing your uptime can be very helpful!
How to determine system uptime
The easiest way to find the system uptime is to issue the uptime
command:
uptime
And the result you will see will look something like this:
[root@int-dns-lnr1-01 ~]# uptime 11:12:41 up 2 days, 11:34, 1 user, load average: 0.00, 0.00, 0.00
This command also gives us some additional information. This shows one person is logged in. You can also see the system load is 0.00 and the uptime is 2 days, 11 hours, 34 minutes. The 11:12:41 is the current time that the command ran.
If you see uptime exceeding 30 days, chances are you might need a reboot. Obviously, don’t just willy-nilly reboot systems unless you know you can take a system down for a short period of time.