How to check reboot history in Linux. There are several commands to check last reboot time in Linux command line which are very helpful.
Using terminal you can easily check the last restart time in Linux Ubuntu server.
Who Command To Check The Last Reboot Time
‘who’ prints information about users who are currently logged on. When executed, ‘who’ prints the following information for each user currently logged on: login name, terminal line, login time, and remote hostname or X display.
who -b
who -b command print the date and time of last system boot.
You can also use the command who -q or who –count to print only the login names and the number of users logged on.
Last Command To Check The Last Reboot Time
last or lastb command is used to show a listing of last logged in users. The last command searches back through the /var/log/wtmp file and displays a list of all users logged in (and out) since that file was created.
How To Check Last 10 Reboot In Linux Ubuntu
You can use the last command to display last logged in users and system last reboot time and date:
last reboot | less
last reboot | head -1
If you want to finding systems’ last shutdown date and time, run the following command:
last -x|grep shutdown | head -1
You can also check the last reboot time with who command in Linux. To check the last reboot time, use the command who -b and it will show when the system was rebooted.
Note that the above command only shows us information about the current boot and not about previous boots.
If you want to check previous restart and reboot information, you can use dmesg command in Linux. To view the last reboot time, we can run dmesg | grep “systemd-” | head -n 10. This command will show the last 10 lines that contain the word “systemd”.
You can easily get information about the last system reboot.