The three query methods for the last reboot time of the Linux system

  
For the engineers who are developing or operating the Linux platform, it is often necessary to query the last reboot time of the system. Here, I will share the three methods for querying the last reboot time of the Linux system. :

Method one: last command
# last reboot
reboot system boot 2.6.32-431.el6.i Wed Jul 30 13:44 - 21:39 (46+07:55)
reboot system boot 2.6.32-431.el6.i Sun Apr 13 14:28 - 09:27 (107+18:59)
reboot system boot 2.6.32-431.el6.i Tue Mar 25 22:27 - 14:19 (18+15:52)
This command actually shows the system runtime in the last few days. Last was originally designed to display the login history of a particular user. In Linux, there is a special "pseudo-user" called "reboot" that automatically logs in immediately when the system is restarted. This way you can check the last reboot time by checking the login history of the reboot user.
Method 2: who -b
Use the who command to bring the ‘-b’ option.
# who -b
system boot Jul 30 13:44
Method 3: uptime command
You can also use the uptime command to infer the system's last boot time. The uptime command will display the current time and also the time the system has been running. From this information, you can calculate the time when the system was last started.
# uptime
21:46:31 up 46 days, 8:02, 1 user, load average: 0.04, 0.05, 0.01

Copyright © Windows knowledge All Rights Reserved