There are multiple reasons why one would want to check when the Linux server was rebooted. For example, checking the last reboot time of a Linux server is crucial for troubleshooting, as it helps identify if issues began after a reboot due to recent changes.
The easiest way to check when the Linux server was last rebooted is to use the who command as shown here:
who -b 
As you can see, it shows the last reboot time when your system was booted.
In this tutorial, I will walk you through four ways you can find when a Linux server was last rebooted:
- Using the uptime command
- Using the who command
- Using the last reboot command
- Using the uprecords utility
Let’s start with the first one.
Table of Contents
1. Using the last reboot command
The last command is the most useful tool to find when the system is rebooted as it offers multiple flags to fine-tune the output. The simplest way to check the system reboot history is by using the last reboot command without any flags and it will display all the reboots in reverse chronological order:
last reboot 
Each line shows a reboot event, including the date and time of the reboot, and if applicable, the duration for which the system was running before being rebooted again.
Apparently, you can limit the number of entries displayed by using the -n option followed by the number of entries you wish to see:
last reboot -n <number-of-lines> For example, if I want to check entries for the last five reboots, then I will use the following command:
last reboot -n 5 
2. Using the uptime command
The uptime command is one of the simplest ways to check how long a system has been running since the last boot. It provides a quick snapshot of the current time, how long the system has been up, how many users are currently logged on, and the system load averages.
To get the exact boot time, you will need to execute the uptime command with the -s flag as shown here:
uptime -s 
If you want more detailed output, you can execute the uptime command without any additional flags:
uptime 
Here’s a breakdown of what each part of this output means:
- 12:57:16: This is the current system time when the command was executed.
- up 1:49: This indicates that the system has been running for 1 hour and 49 minutes since it was last booted. The “up” time is a measure of how long the system has been operational without a reboot.
- 1 user: This shows that there is currently one user logged into the system. This count includes all users logged in through various terminals or remotely via SSH.
- load average: 2.43, 1.99, 1.39: These numbers represent the system’s load average over three different time intervals:
- 2.43 is the average load over the last 1 minute.
- 1.99 is the average load over the last 5 minutes.
- 1.39 is the average load over the last 15 minutes.
3. Using the who command
The who command in Linux is used to find the logged-in users but when you pair it with the -b flag, it can show you the last boot time as well:
who -b 
Here’s a detailed explanation of what this output means:
- system boot: This label indicates that the information being displayed pertains to the last time the system was booted.
- 2024-10-02: This is the date when the system was last rebooted. In this case, it shows that the last boot occurred on October 2, 2024.
- 16:37: This is the time of day when the system was last booted, given in a 24-hour format. Here, it indicates that the system was booted at 4:37 PM
4. Using the uprecords utility
Note: The uprecords utility will start counting the reboots after you install the uprecords. This means you can not access reboot records prior to the system state when uprecords was not installed.
The uprecords utility does not come pre-installed and to use this utility, you need to install a package called uptimed. If you are using a Debian-based distro, then you can use the following command to install it:
sudo apt install uptimed Once done, you can run the uprecords utility as shown here:
uprecords 
Here’s a breakdown of each section:
- Uptime Records:
- #: The record number, indicating the sequence of uptime periods.
- Uptime: The duration for which the system was continuously up during each period.
- System: The kernel version running during each uptime period.
- Boot up: The exact date and time when the system was booted for each record.
- Record #1:
- Uptime:
0 days, 09:15:58indicates that the system was up for approximately nine hours and sixteen minutes. - Boot Time: The system was booted on
Wed Oct 2 at 11:07:50, 2024.
- Uptime:
- Record #2 (Current Session):
- Marked with an arrow (
->), showing the current uptime session. - Uptime:
0 days, 00:00:50, meaning the system has been up for just fifty seconds since the last boot. - Boot Time: The current session started on
Wed Oct 2 at 20:24:08, 2024.
- Marked with an arrow (
- Summary Statistics:
- no1 in: Indicates when the next record might surpass the longest uptime if current trends continue.
- up: Total uptime recorded since tracking began with
uptimed, which is0 days, 09:16:48. - down: Total downtime recorded, which is
0 days, 00:00:20. - %up: The percentage of time the system has been up since tracking began, which is
99.940%.
If you want to sort by the newest records first, you can use the -B flag with the uprecords command as shown here:
uprecords -B 
Alternatively, if you want to sort by oldest boots first, then you’d need to pair the uprecords command with the -b flag as shown here:
uprecords -b 
Wrapping Up…
In this tutorial, I went through four methods to determine the last reboot time of a Linux server, which is crucial for troubleshooting. The last reboot command displays all reboots in reverse chronological order and can be limited to show a specific number of entries.
The uptime command provides a snapshot of how long the system has been running since the last boot and can show the exact boot time with the -s flag.
The who -b command directly shows the last boot time, including both date and time. Lastly, the uprecords utility, which requires installation, tracks uptime records from its installation point and provides detailed information on boot times and uptime durations. I personally find the last method more useful and interactive to use.



