Linux Command Reference ยท Special Files and Directories
/proc/loadavg and uptime
Reference for /proc/loadavg and /proc/uptime: the five fields, what the 1, 5 and 15 minute load averages measure, and how to compare load to CPU count.
Two small files report how busy the machine is and how long it has been up. /proc/loadavg holds the load averages: the average number of tasks that were running or waiting for the CPU (and, on Linux, waiting for uninterruptible disk I/O) over the last 1, 5 and 15 minutes. /proc/uptime holds the seconds since boot and the total idle time of all CPUs.
The uptime command prints the same load numbers beside the clock and the user count, and w and top show them in their headers. The load average only has meaning when compared with the number of CPUs: a load of 4 is idle-ish on a 16-core server and a disaster on a single core.
cat /proc/loadavg
# 0.52 0.58 0.59 2/312 18847
Try it
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.
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
/proc/loadavg has five space-separated fields:
| Field | Description |
|---|---|
| 1 | Load average over 1 minute. |
| 2 | Load average over 5 minutes. |
| 3 | Load average over 15 minutes. |
| 4 | running/total: the number of currently runnable scheduling entities, and the total that exist. |
| 5 | The PID most recently created. |
/proc/uptime has two numbers with two decimals: seconds since boot, and the sum of idle seconds across all CPUs (can be larger than uptime on multi-core machines).
Edge cases: the averages are exponentially damped, so a spike shows up slowly and fades slowly. Inside a container the files show the host's values.
Usage notes
- Rule of thumb: divide the load by the number of logical CPUs (
nproc --all). Below about 0.7 is comfortable; sustained above 1.0 means tasks are queuing. - Read the three numbers together.
5.0 2.0 1.0means load is climbing;1.0 2.0 5.0means a busy period just ended. - Linux counts disk waits. A machine stuck on a slow disk or network filesystem shows a high load with idle CPUs. Check
topforwaand tasks in stateD. - Load is not CPU percent. One CPU-bound process on an 8-core box gives a load near 1 but only 12 percent CPU.
- Uptime for scripts:
awk '{print int($1)}' /proc/uptimegives whole seconds. Boot time is the current time minus that value. - Pressure stall information in
/proc/pressure/cpu,memoryandio(kernel 4.20 and newer) is a more precise "is something waiting" measure than load average. - Monitoring: alert on load per CPU, not the raw number, and use the 5 or 15 minute average to avoid noise.