← All commands
THE COMMAND REFERENCE

uptime

Show how long the system has been running and the load.

Last updated

GNU

Implementation-level reference; examples are not certified for every installed version.

Overview

uptime prints one line: the current time, how long the machine has been running, how many users are logged in, and the load averages for the last 1, 5 and 15 minutes. A load average is roughly the number of programs waiting to run; compare it with the number of processors.

Background

The uptime command appeared in 3.0BSD, according to the macOS manual. Today the name covers GNU uptime, the uptime that macOS ships, and the uptime applet in BusyBox. They agree on printing one line that includes up.

Examples

Print the line and check that it contains up; the numbers change all the time:

uptime | grep -c up

Show only the load averages by cutting the line at its label; the word load appears on all three systems:

uptime | grep -c load

Common mistakes

The exact layout, the number of users and the wording of the days differ between systems, so do not parse the line in a portable script. Read /proc/loadavg on Linux or use sysctl -n vm.loadavg on macOS for the numbers alone. A load average above the number of processors means programs are waiting.

Portability

Only the presence of up and load is in the Common examples. GNU, macOS and BusyBox lay out the line differently. The Linux guest used for the BusyBox checks does not install GNU uptime, so the GNU examples for this page ran on macOS with Homebrew coreutils 9.11 only. The Common examples were executed on GNU coreutils 9.11, macOS system tools, and BusyBox 1.37.0 (see the development guide for the exact check).

About GNU uptime

GNU uptime is part of GNU coreutils, and this page's checks ran coreutils 9.11.

References

Original explanations, with upstream documentation for further reading. FreeBSD references are comparison material, not a claim of Apple version equivalence.