Skip to content
Tutorials Center
My learning

Topics

Linux Command Reference ยท Processes and Signals

Linux uptime command

Reference for the Linux uptime command: how long the system has run, how many users are logged in, and how to read the three load average numbers correctly.

uptime prints one line: the current time, how long the system has been running, how many users are logged in, and the load averages for the last 1, 5 and 15 minutes. It is the quickest health check on a server, and the load average is the first number most administrators look at.

The load average is not CPU percentage. It counts the tasks that were runnable or waiting for uninterruptible I/O, averaged over a window. All values come from the kernel, through /proc/loadavg and /proc/uptime.

Terminal
uptime [-p | -s | -h | -V]

Try it

Bash What the numbers mean

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Bash Turning seconds into a readable uptime

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Syntax

Terminal
uptime [options]
Option Description
(none) HH:MM:SS up 3 days, 2:11, 2 users, load average: 0.15, 0.20, 0.18
-p, --pretty Short human form, for example up 3 days, 2 hours, 11 minutes.
-s, --since The moment the system booted, as YYYY-MM-DD HH:MM:SS.
-h, --help Show help.
-V, --version Print the version (procps-ng).

Returns: 0 on success, non-zero if /proc cannot be read.

Usage notes

  • Reading the load. On a machine with N CPU cores, a load of N means every core is busy on average; much above N means tasks are queuing. Compare with nproc.
  • Three windows show the trend. 0.50, 2.00, 4.00 means the load is falling; 4.00, 2.00, 0.50 means it is rising. The 15-minute figure filters out short spikes.
  • Linux counts waiting I/O. Tasks stuck in uninterruptible sleep (usually disk or network filesystem waits) raise the load even when the CPUs are idle. A high load with a low CPU use points at storage. See vmstat and top.
  • The averages are exponentially damped, not true means; they never drop to zero instantly after a burst.
  • "users" is logged-in sessions, from the login records, not accounts. Containers often show 0.
  • Uptime in containers and VMs shows the host kernel's uptime, because containers share the kernel; a container's own age is the start time of its first process.
  • w prints the same first line, followed by what each user is doing; see who and w.
  • Scripts should read /proc/loadavg or /proc/uptime directly instead of parsing the human-readable line, whose format varies with locale and uptime length (5 min versus 1 day).