LESSON · 1 OF 6

Uptime and load average

Uptime and load average

bash
uptime

Prints one line:

 19:15:42 up 3 days,  4:12,  2 users,  load average: 0.42, 0.55, 0.61

Three pieces:

  • How long the machine has been up. Handy when someone asks "when was this last rebooted?"
  • Users currently logged in. Anyone besides you.
  • Load average. The three numbers on the right, and the useful part.

What load average means

The three numbers are the load average over the last 1 minute, 5 minutes, and 15 minutes. Each number is roughly the average count of processes wanting the CPU during that window.

The trick is comparing to the number of CPU cores:

  • Load below the core count means the machine has capacity to spare.
  • Load around the core count means fully utilized.
  • Load above the core count means processes are queuing for CPU.

A load of 4.0 on an 8-core box is 50% utilization, healthy. The same load on a 2-core box means it's overloaded. Always compare load against nproc:

bash
nproc

Prints the core count in one number.

Reading the three numbers together

  • 1-min rising, 15-min low: something just started spiking. May resolve on its own.
  • 1-min low, 15-min high: things were bad, calming down now.
  • All three high: sustained overload, time to investigate.

Load average tells you the machine is busy. It doesn't tell you what's making it busy. That's what top is for, coming up next.

The raw source: /proc/loadavg

The three numbers uptime prints come from a file the kernel keeps updated in real time:

bash
cat /proc/loadavg

You'll see something like 0.42 0.55 0.61 2/312 4567 - the three load averages, then the count of runnable/total processes, then the last PID created. Scripts that need just the numbers (with no parsing) read /proc/loadavg directly instead of picking values out of the uptime line.

Spin up a fresh environment and practice live.
linux-devops-basic · fresh machine · ready in under a minute