There are several ways you can get information about reboots and shutdowns on a Linux or UNIX system. Here are a few options:
Check the /var/log/wtmp
file. This file contains a record of all logins and logouts on the system. You can use the last
command to view the contents of this file and see when the system was last shut down or rebooted.
Check the /var/log/messages
file. This file contains a record of system events, including reboots and shutdowns. You can use the grep
command to search for specific events in this file. For example, to search for shutdown events, you can use the following command:
grep -i "shutdown" /var/log/messagesSourw:ecww.lautturi.com
Use the uptime
command. The uptime
command shows the current time, the length of time the system has been running, and the number of users logged in. You can use the uptime
command to see how long the system has been running since the last reboot.
Use the who -b
command. The who -b
command shows the time of the last system boot.
Use the systemd-analyze
command. If your system is using the systemd init system, you can use systemd-analyze
command.