uptime – show how long the system has been running

uptime command
uptime command

uptime shows how long the system has been running, along with users logged in and system load.

Synopsis

uptime [OPTIONS]

Examples

Basic output

$ uptime
 14:30:00 up 7 days,  3:45,  2 users,  load average: 0.15, 0.20, 0.18

Pretty format

$ uptime -p
up 7 days, 3 hours, 45 minutes

Since when (boot time)

$ uptime -s
2025-01-22 10:45:00

Understanding Load Average

load average: 0.15, 0.20, 0.18
              │     │     │
              │     │     └─ 15-minute average
              │     └─ 5-minute average
              └─ 1-minute average
  • Load < # of CPUs: System has spare capacity
  • Load = # of CPUs: System is fully utilized
  • Load > # of CPUs: Processes are waiting

Check CPU count

$ nproc
4

# Load of 4.0 on a 4-core system = 100% utilized
# Load of 8.0 on a 4-core system = overloaded

Common Patterns

Check in scripts

#!/bin/bash
LOAD=$(uptime | awk -F'load average:' '{print $2}' | cut -d, -f1)
if (( $(echo "$LOAD > 4" | bc -l) )); then
    echo "High load: $LOAD"
fi

Monitor uptime

$ watch uptime

Tips

  • High load isn’t always bad: Check with top to see why
  • I/O can cause high load: Processes waiting for disk
  • Check history: Use sar for historical load data
  • After reboot: Uptime resets to zero

See Also

  • w — Uptime + who’s logged in + what they’re doing
  • top — Real-time process and load info
  • last — Reboot history

Tutorials