Python System Uptime, Load & Reboot History
The `uptime` command reports how long the system has been running, current active user sessions, and 1, 5, and 15-minute system load averages. Inspecting reboot history (`last reboot`) and kernel uptime gives insight into system reliability.
"`uptime` is like an engine odometer and temperature gauge: it shows how many continuous hours the machine has been running without a pit stop."
Deep Dive: How It Works
uptime Output: Current system time, up duration (days, hours, mins), active user count, and load average over 1, 5, 15 minutes.
Pretty Printing: `uptime -p` outputs clean human-readable uptime (e.g. "up 2 weeks, 3 days, 1 hour").
/proc/uptime: First number is total seconds up; second number is seconds spent in idle process.
Syntax Blueprint
uptime # Full status with load averages uptime -p # Pretty uptime format uptime -s # Date and time of last system boot cat /proc/uptime # Kernel uptime in raw seconds
Use uptime -p for readable formatting and uptime -s to find when the server booted.
Core Rules to Remember



Common Beginner Traps & How to Fix Them
Assuming a load average of 4.0 means the server is overloaded.Why it happens: Load capacity scales with CPU core count (e.g. on an 8-core CPU, load 4.0 is only 50% utilized).
How to fix: Compare load average against `nproc` (number of CPU cores).
Live Interactive Example
Hit Run Code to see it liveYour Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Query Number of CPU Cores
Run `nproc` to print the number of processing cores.
Finished reading and practicing?
Mark this lesson as completed to update your course progress.