uptime
Show how long the system has been running
TLDR
Print current time, uptime, number of logged-in users and other information
Show only the amount of time the system has been booted for
Print the date and time the system booted up at
Display version
SYNOPSIS
uptime [options]
PARAMETERS
-p, --pretty
Shows the system uptime in a more human-readable, "pretty" format (e.g., "up 1 day, 5 hours, 30 minutes").
-h, --help
Displays a help message and exits.
-s, --since
Shows the date and time when the system was last booted. This output format is suitable for parsing by scripts.
-V, --version
Displays version information for the uptime command and exits.
DESCRIPTION
The uptime command in Linux is a utility that provides a quick overview of a system's operational status. It reports three key pieces of information: the current time, how long the system has been running continuously since its last boot (uptime), the number of users currently logged in, and the system load averages for the past 1, 5, and 15 minutes.
This command is particularly useful for system administrators and users alike to quickly ascertain the health and activity level of a server or workstation. The load averages indicate the average number of processes that are either in a runnable or uninterruptible state, giving insight into how busy the CPU is. A higher load average typically signifies a busier system. uptime is part of the procps or procps-ng package on most Linux distributions.
CAVEATS
The load average values can sometimes be misleading on systems with multiple CPU cores or hyper-threading, as they reflect the number of processes waiting, not necessarily a percentage of CPU utilization. For example, a load of 1.0 on a single-core CPU means it's fully utilized, but on a 4-core CPU, it means only 25% utilization. Sustained high load averages (relative to the number of CPU cores) suggest a system bottleneck.
UNDERSTANDING LOAD AVERAGES
Load averages represent the average number of processes that are either in a runnable state (waiting for CPU) or an uninterruptible sleep state (waiting for I/O) over the last 1, 5, and 15 minutes.
Key points:
- A value of 1.0 on a single-core system means the system is fully utilized. On a multi-core system, a load average approximately equal to the number of CPU cores implies full utilization.
- Sustained load averages significantly higher than the number of CPU cores indicate a bottleneck, either CPU-bound or I/O-bound.
TYPICAL OUTPUT FORMAT
The standard output of uptime usually follows this format:
current_time up uptime, users_logged_in, load_average_1min, load_average_5min, load_average_15min
Example: 10:30:45 up 2 days, 15:20, 3 users, load average: 0.15, 0.22, 0.18
HISTORY
The uptime command has been a fundamental utility in Unix-like operating systems for decades, dating back to early BSD versions. It's a standard component of the procps (or its successor procps-ng) package, which provides a set of system utilities for monitoring and controlling processes and system resources on Linux. Its core functionality has remained largely consistent, reflecting its simple yet essential role in system diagnostics. Modern versions might include minor enhancements like the --pretty option for improved readability.