Knowing how long your Linux server has been running helps you confirm that a reboot completed successfully, track availability and spot unexpected restarts. Several commands expose this information directly from the terminal, each presenting it in a slightly different format.
This article covers three commands for checking system uptime in Linux: uptime, w and last reboot. You will also see how to read the /proc/uptime file for a raw value.
The uptime command is the most direct way to see how long your server has been running. It outputs the current time, total uptime, number of logged-in users and the system load averages for the past 1, 5 and 15 minutes.
Run the following command in your terminal:
uptime
You will see output similar to this:
14:32:07 up 12 days, 3:47, 2 users, load average: 0.05, 0.03, 0.00
The up 12 days, 3:47 portion tells you the server has been running for 12 days and 3 hours 47 minutes since its last boot. The load averages indicate how busy the CPU has been over each time window. Values consistently above the number of CPU cores on your server suggest the system is under heavy load.
To display uptime in a more readable format, pass the -p flag:
uptime -p
This outputs a plain-language string such as up 12 days, 3 hours, 47 minutes, without the additional load and user data.
The w command shows who is currently logged in and what they are doing, but its header line also includes uptime information. This is useful when you want uptime alongside an overview of active sessions.
Run the command:
w
The first line of the output matches the format produced by uptime, showing the current time, how long the system has been running and the load averages. The rows below list each logged-in user, their terminal, login time and current process.
The last reboot command reads the system login records and displays a history of reboots. This is particularly useful when you need to confirm when a server was last restarted, or to check whether an unexpected reboot occurred.
Run the command:
last reboot
Each line in the output shows the date and time of a reboot event, along with how long that session lasted before the next restart. The most recent entry appears at the top.
Linux exposes raw uptime data through the /proc/uptime file. The file contains two numbers: the total seconds the system has been running and the total seconds the system has spent idle. Scripts and monitoring tools often read this file directly because it requires no parsing of formatted output.
Display the file contents with:
cat /proc/uptime
Example output:
1058820.34 4147201.56
The first value (1058820.34) is the number of seconds since the last boot. Divide by 86400 to convert to days. The second value is the cumulative idle time across all CPU cores, which can exceed the uptime figure on multi-core systems.
The -p flag is available in procps-ng versions shipped with most modern distributions, including Ubuntu 20.04 and later and AlmaLinux 8 and later. On older systems or minimal installations, the flag may not be recognised.
uptime --version to confirm the installed version.uptime without flags and read the uptime value from the standard output line.The last command reads from /var/log/wtmp. If this file has been rotated, cleared or was never created, the command returns no results.
/var/log/wtmp exists: ls -lh /var/log/wtmpjournalctl --list-boots to view boot history from the journal./var/log/wtmp.* or use last -f /var/log/wtmp.1 to read the previous log file.You can now check system uptime in Linux using uptime, w, last reboot and the /proc/uptime file. Each method surfaces the same underlying data in a different format, so you can choose whichever suits your workflow or scripting needs.
For broader server monitoring, see our guides on checking directory sizes in Linux and checking open ports on Linux. If you need to connect to your server before running these commands, our guide on connecting via SSH walks you through the process.
Our VPS hosting plans give you full SSH access and root-level control over your server environment.
Get scalable resources with our VPS hosting with root access and optional software.
Get VPS HostingPerfect for websites and small businesses unlimited bandwidth with cPanel hosting.
Get cPanel Hosting