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

Debug by checking the shutdown time and restarting in Linux

  1. Last boot
  2. Restart
  3. The latest reboot
  4. Shutdown
  5. Last shutdown
  6. Operation time

Last boot

How to check the time of shutdown and reboot in Linux Picture 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 Picture 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 Picture 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 Picture 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 Picture 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 Picture 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.

4.3 ★ | 12 Vote

May be interested

  • How to check whether a Linux PC is 64-bit or 32-bit by command lineHow to check whether a Linux PC is 64-bit or 32-bit by command line
    how to check if your linux system is 32-bit or 64-bit? in this article, tipsmake.com will show you how to define it using the gui and the command line.
  • Disable Hybrid Boot and Shutdown on Windows 8Disable Hybrid Boot and Shutdown on Windows 8
    hybrid boot and hybrid shutdown is the process of speeding up the startup and speeding up the normal shutdown time on windows operating system. typically, when you perform either hybrid boot and hybrid shutdown features, your computer will undergo a complicated process before booting or actually shutdown.
  • How to schedule automatic shutdown on macOSHow to schedule automatic shutdown on macOS
    on macos, there is a feature to set the time to automatically shut down shutdown, put the device into sleep sleep state or restart restart automatically. or users can set up any time for the mac to shut down automatically.
  • Shutdown timer, Restart, Log off for the computerShutdown timer, Restart, Log off for the computer
    free tool to help you schedule, configure the computer to automatically shutdown shutdown after a period of time, restart restart, sleep, log off, ...
  • How to check your Linux versionHow to check your Linux version
    if you need to find the actual linux version or even the linux kernel version, please read the following article.
  • How to check MAC address on LinuxHow to check MAC address on Linux
    the steps to find and check mac address on windows and macos are quite simple. so what about on linux? what ways are there to check mac address on linux?
  • Instructions for creating Slide to Shut Down shortcut on Windows 10 computerInstructions for creating Slide to Shut Down shortcut on Windows 10 computer
    slide to shutdown is a feature that is integrated from windows 8, 8.1 and windows 10. this is a feature that helps you turn off quickly, shorten a lot of time to perform computer shutdown just by sliding the screen down. in the article below, network administrator will guide you how to create a slide to shut down shortcut on a windows 10 computer
  • How to Automatically Shut Down Your Computer at a Specified TimeHow to Automatically Shut Down Your Computer at a Specified Time
    this wikihow teaches you how to configure your mac or pc to safely shut down at a certain time. make sure you save your files frequently so you don't lose data during a shutdown. open the task scheduler app. if you want your scheduled...
  • Shutdown command - Schedule the shutdown of Windows 10 with the Shutdown commandShutdown command - Schedule the shutdown of Windows 10 with the Shutdown command
    shutdown command - schedule the shutdown of windows 10 with the shutdown command. you are downloading or automatically processing something on your computer but you do not wait until it is finished to turn off the computer. so you want to find a way to shut down your computer using shutdow
  • How to check all services running in LinuxHow to check all services running in Linux
    need to know all the services running on the system. in this article, tipsmake.com will show you all possible ways to list the services running on linux computers.