Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Check the Time of Shutdown and Reboot in Linux

Learn how to check the Time of Shutdown and Reboot in Linux with clear steps, practical examples, and troubleshooting tips for safer, more reliable results.

Table of Contents

How to Check the Time of Shutdown and Reboot in Linux is easier to understand when the core ideas are paired with practical examples. The sections below explain the topic clearly, highlight useful steps, and point out details that can prevent common errors.

There are many reasons why you might want to find out when your Linux computer is off, reboot or how long it will run. In most cases, this information is invaluable in debugging a problem. Fortunately, Linux automatically 'meticulously' records system events on most distributions. Additionally, accessing information recorded from the command line is also very easy.

Last boot

How to Check the Time of Shutdown and Reboot in Linux example image 1

First, if you want to check the boot computer for the last time, you can use the who command with the -b flag to get the exact date and time in the terminal. You do not need root privileges when checking this information.

 who -b 

Restart

How to Check the Time of Shutdown and Reboot in Linux example image 2

With the last command , you can list information each time the system restarts. This information does not include all times when the system has used the reboot command or when rebooting from the desktop. Instead, Linux logs every time the system starts.

 last -x reboot 

The latest reboot

How to Check the Time of Shutdown and Reboot in Linux example image 3

If you like a more concise version, only showing the most recent boot time, you can switch the output to head and provide parameter -1, to request only one line. If you need information about the last 2 starts, use -2 to export both lines.

 last -x reboot | head -1 

Shutdown

How to Check the Time of Shutdown and Reboot in Linux example image 4

The last command works similarly to the shutdown times. These are times when the computer is completely turned off. This information provides a time range that includes all times the computer is turned off. You can put them in parallel with the reboots to know the corresponding shutdown.

 last -x shutdown 

Last shutdown

How to Check the Time of Shutdown and Reboot in Linux example image 5

As with previous reboots, you can switch the output to head to get only the information about the last shutdown. Just like before, you can provide different numbers, such as -3 to get information about the last 3 shutdowns.

 last -x shutdown | head -1 

Operation time

How to Check the Time of Shutdown and Reboot in Linux example image 6

Finally, when you want to know how long your computer has been running, you can use the uptime command to find out this information. Combine uptime commands with the -p flag to get more readable output. You will receive the duration in days, hours and minutes that the computer has turned on since the last boot.

 uptime -p 

Hopefully, with the above commands, you can find some suggestions or even the cause behind the problem related to rebooting and shutdown. If you suspect other programs, you can check specific log files in '/ var / log'.

Hope you are succesful.

FAQ

What is How to Check the Time of Shutdown and Reboot in Linux?

There are many reasons why you might want to find out when your Linux computer is off, reboot or how long it will run.

Why is How to Check the Time of Shutdown and Reboot in Linux important?

A clear understanding of How to Check the Time of Shutdown and Reboot in Linux helps you make informed decisions, avoid common mistakes, and use the relevant tools or techniques more effectively.

How should beginners approach How to Check the Time of Shutdown and Reboot in Linux?

Start with the fundamental concepts, follow the examples step by step, and test each change in a safe environment before applying it to important systems or data.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.