How to check last reboot time in Linux

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. In this post, you will learn how to check the last system reboot. Although it may not seem like it, the truth is that it is quite useful in administrative matters.

Occasionally, it is necessary to know when was the last time the system was rebooted. Especially for administrative purposes.

Fortunately, there are many ways to do this. So, we won’t have any problems doing it.

How to check the last reboot of the system

Using the last command

A fairly simple way to do this is to use the last command and combine it with the head command.

To achieve this, open a terminal and run

last reboot|head -2

This will give you the last two reboots of the system in an orderly output.

reboot   system boot  6.0.2-060002-gen Thu Dec  8 18:34   still running
reboot   system boot  6.0.2-060002-gen Wed Dec  7 17:21 - 20:19  (02:58)

An advantage of this command is that you can modify it to get more reboots. For example,

last reboot|head -4

This will give you the last 4 reboots.

How to check the last reboot of the system
How to check the last reboot of the system

Pretty straightforward.

Using the who command

Slightly simpler and a little less flexible is the who command.

To achieve this, just run

who -b

sample Output

system boot  2022-12-08 18:34

Using the uptime command to check the last system reboot

The next method is with the uptime command. This command is used to check how long the system has been booted.

However, the uptime command has an -s option, with which you can check the last reboot.

To achieve this, simply run

uptime -s

Sample output:

2022-12-08 18:34:50

Conclusion

It is common to reboot the system, but it is not as common to know how to check when to reboot. On a desktop user, it’s probably not relevant, but on a server, it can save a lot of trouble.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook