Five Commands To Check Linux System Shutdown/Reboot Date and Time

We can easily check how long our Linux system has been up and running without downtime.

There are many commands are available to check this and we had written an article about this in the past.

If so, navigate to the following URL to view the system uptime in Linux.

Do you know, how to check system shutdown and reboot date and time?

Do you know when the system was rebooted and shutdown?

As a Linux administrator, it’s our job to keep a system up and running without any downtime. It should be minimal downtime.

It can be verify with the following five commands. Let’s see how it is.

  • uptime: uptime command will tell how long the system has been running.
  • last: The last command uses /var/log/wtmp file to display an users login information.
  • who: Print information about users who are currently logged in.
  • stat: stat command displays the detailed status of a particular file or a file system.
  • procinfo: Display system status gathered from /proc.

How To Check Linux System Reboot Date and Time Using uptime Command?

uptime command will tell how long the system has been running. It gives a one line display of the following information.

The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

The uptime command will fetch the details from the /proc/uptime file and print the server uptime with humans readable format. As per the below output, the Linux system got rebooted on 2019-03-03.

# uptime -s
2019-03-17 00:08:05

How To Check Linux System Shutdown/Reboot Date and Time Using last Command?

utmp & wtmp files contains logs for logins and logouts. These are binary files and we can’t able to see with any text editor.
It’s located on /etc/log directory.

  • /var/run/utmp: It contains information about the users who are currently logged onto the system. Who command is used to fetch the information from the file.
  • /var/log/wtmp: It contains historical utmp. It keeps the users login and logout history. The last command uses this file to display the information.
  • /var/log/btmp: It contains bad login attempts.

Use the following command to check the system reboot date and time in Linux.

$ last -x reboot
reboot   system boot  2.6.32-754.el6.x Sun Mar 17 00:07 - 01:00  (00:53)    
reboot   system boot  2.6.32-754.el6.x Sat Mar 16 23:59 - 01:00  (01:00)    
reboot   system boot  2.6.32-754.el6.x Sat Mar 16 23:51 - 01:00  (01:08)    
reboot   system boot  2.6.32-754.el6.x Sat Mar 16 01:25 - 01:00  (23:34)    
reboot   system boot  2.6.32-754.el6.x Fri Mar 15 13:21 - 01:00 (1+11:38)   
reboot   system boot  2.6.32-754.el6.x Sun Mar 10 01:27 - 01:00 (6+23:32)   
reboot   system boot  2.6.32-754.el6.x Wed Mar  6 06:58 - 01:00 (10+18:02)  
reboot   system boot  2.6.32-754.el6.x Mon Feb 25 01:40 - 01:00 (19+23:20)  
reboot   system boot  2.6.32-754.el6.x Tue Feb 19 09:46 - 01:00 (25+15:13)  
reboot   system boot  2.6.32-754.el6.x Tue Feb 19 04:43 - 01:00 (25+20:16)  
reboot   system boot  2.6.32-754.el6.x Sun Feb 17 11:48 - 01:00 (27+13:11)  
reboot   system boot  2.6.32-754.el6.x Sun Feb 17 10:02 - 11:46  (01:44)    
reboot   system boot  2.6.32-754.el6.x Fri Feb 15 14:03 - 21:17  (07:14)    
reboot   system boot  2.6.32-754.el6.x Fri Feb 15 13:50 - 14:02  (00:12)    
reboot   system boot  2.6.32-754.el6.x Fri Feb 15 13:47 - 13:49  (00:02)    

wtmp begins Fri Feb 15 13:47:34 2019

Use the following command to check the system shutdown date and time in Linux.

$ last -x shutdown
shutdown system down  2.6.32-754.el6.x Sun Feb 17 11:47 - 11:48  (00:00)    
shutdown system down  2.6.32-754.el6.x Fri Feb 15 14:02 - 14:03  (00:00)    
shutdown system down  2.6.32-754.el6.x Fri Feb 15 13:49 - 13:50  (00:00)    

wtmp begins Fri Feb 15 13:47:34 2019

How To Check Linux System Shutdown/Reboot Date and Time Using who Command?

Print information about users who are currently logged in. It uses /var/run/utmp file to fetch an user information.

$ who -b
         system boot  2019-03-17 00:07

How To Check Linux System Shutdown/Reboot Date and Time Using stat Command?

These functions return information about a file. stat command displays the detailed status of a particular file or a file system.

$ stat /var/log/dmesg | grep Modify
Modify: 2019-03-17 00:07:05.771999993 -0700

How To Check Linux System Shutdown/Reboot Date and Time Using procinfo Command?

procinfo gathers some system data from the /proc directory and prints it nicely formatted on the standard output device.

$ procinfo | grep Bootup
Bootup: Sun Mar 17 00:07:10 2019   Load average: 0.07 0.03 0.01 1/290 2186

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...