Linux / UNIX: Getting information about reboots and shutdowns

Linux / UNIX: Getting information about reboots and shutdowns

There are several ways you can get information about reboots and shutdowns on a Linux or UNIX system. Here are a few options:

  1. 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.

  2. 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/messages
Sour‮w:ec‬ww.lautturi.com
  1. 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.

  2. Use the who -b command. The who -b command shows the time of the last system boot.

  3. Use the systemd-analyze command. If your system is using the systemd init system, you can use systemd-analyze command.

Created Time:2017-10-29 22:08:56  Author:lautturi