The standard Linux uptime command is invaluable for viewing how long a server has been running since its last reboot. However, the moment an operating system restarts or suffers an unplanned power failure, the standard uptime counter resets back to zero, discarding all historical availability records. For system administrators responsible for auditing Service Level Agreements (SLAs), troubleshooting recurring kernel panics, or monitoring electrical outages, historical persistence is essential. The tuptime utility solves this limitation by maintaining a persistent database of all boot cycles, shutdown types, uptime percentages, and downtime durations.
How tuptime Operates in Linux
Unlike transient commands that read directly from /proc/uptime, tuptime runs as an automated background service using a systemd hook or cron job:
- It records timestamps at system startup and proper shutdown.
- It detects unclean shutdowns, power cuts, or hardware freezes by calculating gaps between continuous operational heartbeats.
- It tracks kernel releases associated with each boot session, pinpointing which kernel versions experienced crashes or unplanned reboots.
- It calculates the cumulative system life, total operational hours, and historical uptime percentage over months or years.
How to Install tuptime Across Linux Distributions
The tuptime package is available in official repositories and via GitHub:
- Debian, Ubuntu, and Linux Mint:
sudo apt update && sudo apt install tuptime - Arch Linux:
sudo pacman -S tuptime - Fedora, RHEL, and CentOS (via EPEL or Manual Git Clone):
sudo dnf install python3 python3-pyudev git clone https://github.com/rfrail3/tuptime.git cd tuptime/latest/ sudo make install
Once installed, enable and verify the systemd background tracking unit:
sudo systemctl enable --now tuptime.service
How to Display Overall System Uptime and Downtime Metrics
Running tuptime without flags produces an immediate high-level overview of the host machine:
tuptime
The output reports key reliability metrics:
- System startups: Total boot events logged since installation (e.g.,
14 startups). - System life: The elapsed calendar time since the initial recorded boot.
- System uptime: Cumulative duration the machine has spent in an active state and its percentage (e.g.,
99.82%). - System downtime: Cumulative offline duration resulting from intentional halts or power interruptions.
- Average uptime and downtime: Mean durations calculated across all operating cycles.
- Current uptime: Time elapsed since the current session began, paired with the active kernel version.
How to Inspect Individual Boot Cycles with the -l Flag
To view a chronological ledger of every individual system reboot, run:
tuptime -l
This command prints a tabulated list detailing every recorded boot session, including:
- The startup timestamp and registered kernel build.
- The duration of the active session.
- The exact shutdown time and whether the termination was OK (clean shutdown/reboot) or BAD (kernel crash or power cut).
- The ensuing downtime length before the next startup occurred.
How to Format and Filter tuptime Output
You can customise tuptime reports to fit administrative scripts and audits:
- Display Seconds and Machine-Readable Metrics: Use
tuptime -sto output raw seconds for integration into Zabbix, Prometheus, or shell scripts. - Filter by Date Range: Query uptime records for a specific billing month using the date flags:
tuptime --ts "2026-10-01" --te "2026-11-01" - Output in CSV Format: Generate structured comma-separated data for spreadsheet import:
tuptime --csv > uptime_audit.csv