Beginner Extended

How to check system uptime in Linux

By Angus Published 14 May 2026 4 min read

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.

Before you begin

  • You need SSH access to your Linux server. See our guide on connecting via SSH if you have not set this up.
  • No elevated privileges are required for any of the commands below.

Check uptime with the uptime command

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.

Check uptime with the w command

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.

Find the last reboot time with last reboot

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.

Read raw uptime from /proc/uptime

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.

Troubleshooting

The uptime -p flag returns an error

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.

  • Run uptime --version to confirm the installed version.
  • On older systems, use uptime without flags and read the uptime value from the standard output line.

last reboot shows no output

The last command reads from /var/log/wtmp. If this file has been rotated, cleared or was never created, the command returns no results.

  • Check whether /var/log/wtmp exists: ls -lh /var/log/wtmp
  • If the file is missing, your distribution may use systemd-journald instead. Run journalctl --list-boots to view boot history from the journal.
  • If the file exists but is empty, the log may have been rotated. Check archived logs in /var/log/wtmp.* or use last -f /var/log/wtmp.1 to read the previous log file.

Wrapping up

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.

Need more power?

Get scalable resources with our VPS hosting with root access and optional software.

Get VPS Hosting

Starting something new?

Perfect for websites and small businesses unlimited bandwidth with cPanel hosting.

Get cPanel Hosting