However, sometimes, there are situations when your system shuts down or reboots.

This can be due to the system unexpectedly losing power or some user intentionally rebooting it.

This information will provide you with a starting point to begin the troubleshooting.

Check Your Linux System’s Shutdown and Restart History

It obtains this information from thewtmpfile which maintains a log of every login and logout event.

It also shows the duration for which the system kept running.

you’re able to also check the last specific number of shutdown events using the-nflag.

last shutdown

To check the last specific number of restart events, use the-nflag with the last command.

For instance, to check the last three restart events, the command would be:

2.

For instance, to list the last three entries, the command would be:

3. you might use the who command with the-bflag to display when your system last booted:

4.

last reboot

Using the journalctl Command

The journalctl command is used to query and view logs collected by systemd.

tuptime output

who command in Linux

journalctl command output