Lesson 64: uptime Command
In this lesson, you'll learn how to use the uptime command to check how long your Linux system has been running, how many users are logged in, and how hard the system is working all from a single command.
The uptime command pulls its data from /proc/uptime (system running time) and /proc/loadavg (load averages) both maintained in real time by the Linux kernel.
It is one of the first commands a sysadmin runs when connecting to a server to get an immediate sense of system health.
A quick glance at uptime tells you whether the server recently rebooted unexpectedly, and whether it is under unusual load before you start investigating further.
Syntax
uptime [OPTIONS]
Options
| Option | Description |
|---|---|
-p, --pretty |
Show uptime in a human-friendly readable format |
-s, --since |
Show the date and time the system started |
-V, --version |
Output version information and exit |
-h, --help |
Display help and exit |
Understanding the uptime Output
Before diving into the options, it helps to understand exactly what each part of the default output means.
uptime
20:18:46 up 30 min, 1 user, load average: 1.43, 0.52, 0.45
| Field | What It Means |
|---|---|
20:18:46 |
Current system time |
up 30 min |
How long the system has been running since last boot |
1 user |
Number of users currently logged in |
load average: 1.43, 0.52, 0.45 |
Average number of active processes over the last 1, 5, and 15 minutes |
The three load average numbers are the most important part of the output β they tell you whether the system is coping with its workload or struggling under pressure.
What Are Load Averages?
Load average is the average number of processes in a runnable or uninterruptible state over a given time period:
- A process is runnable when it is actively using the CPU or waiting in the CPU queue to be scheduled.
- A process is uninterruptible when it is waiting on I/O β typically disk reads/writes or network operations β and cannot be interrupted until the I/O completes.
The three numbers represent averages over the last 1 minute, last 5 minutes, and last 15 minutes, respectively.
How to interpret load averages: