# Tuptime | Advanced System Uptime Tracking for Linux

In the world of system administration, keeping tabs on your server's uptime isn't just a nice-to-have—it's essential for diagnosing issues, planning maintenance, and ensuring reliability. While the standard `uptime` command gives you a quick snapshot of how long your system has been running, it falls short when you need **historical data** across reboots. Enter **tuptime**, a lightweight, open-source tool that supercharges uptime reporting by tracking cumulative and per-session statistics, preserving everything in a simple SQLite database.

Developed by Ricardo Marmolejo García and hosted on [GitHub](https://github.com/rfmoz/tuptime), tuptime has been a go-to utility for Linux and FreeBSD admins since its inception. As of October 2025, it's actively maintained, with over 1,000 stars on GitHub and broad compatibility across distributions. Whether you're running a home server, a cloud VM, or an enterprise fleet, tuptime provides insights that go far beyond basic uptime checks.

## Why Choose Tuptime Over the Standard `uptime` Command?

The built-in `uptime` command is great for a one-liner glance:

```plaintext
 14:23:45 up  5 days,  2:15,  1 user,  load average: 0.10, 0.20, 0.25
```

But it resets on every reboot, ignoring your system's full history. Tuptime solves this by:

* **Preserving Data Across Reboots**: Logs every startup, shutdown, uptime, and downtime in a persistent database.
    
* **Statistical Insights**: Reports total system life, average session lengths, longest downtimes, and more.
    
* **No Daemon Overhead**: Runs via cron jobs and init hooks—super lightweight (under 1MB footprint).
    
* **False-Positive Protection**: Ignores glitches from NTP syncs, suspend/resume, or virtualization pauses.
    
* **Flexible Output**: Default summary, tables, lists, CSV, or raw epochs for scripting.
    
* **Queryable Database**: SQLite means you (or other tools) can run custom queries on your data.
    

| Feature | Standard `uptime` | Tuptime |
| --- | --- | --- |
| Historical Data | No | Yes (SQLite DB) |
| Per-Boot Sessions | No | Yes |
| Statistics (Avg/Longest) | No | Yes |
| Output Formats | Text only | Table, List, CSV, Epoch |
| Dependencies | None | Python 3, SQLite |
| Overhead | None | Minimal (cron-based) |

Tuptime shines in scenarios like auditing server reliability, generating reports for SLAs, or integrating with monitoring stacks like Prometheus.

## Key Features at a Glance

* **Core Metrics**: Startups, shutdowns, total life, current uptime, cumulative up/down time.
    
* **Advanced Stats**: Longest/average uptime & downtime, sleeping time accumulation.
    
* **Filtering & Sorting**: By date, duration, or labels.
    
* **Export Options**: CSV for Excel/Pandas, epochs for timestamps.
    
* **Kernel & Boot Info**: Includes boot IDs and kernel versions.
    
* **Cross-Platform**: Linux (all distros), FreeBSD; partial macOS support via ports.
    

## Installing Tuptime | The Famous One-Line Script

Tuptime's hallmark is its **dead-simple installation** via a single bash command. No downloads, no fuss—just pipe and run. This one-liner fetches the official install script from [Git.io](http://Git.io) (a GitHub URL shortener) and executes it:

```bash
bash < <(curl -Ls https://git.io/tuptime-install.sh)
```

### How It Works

1. `curl -Ls`: Downloads silently (`-s`), follows redirects (`-L`), shows errors (`-S`? Wait, it's -s for silent).
    
2. `< <(...)`: Process substitution—feeds the script directly to bash without saving to disk.
    
3. The script:
    
    * Installs Python 3 and SQLite if missing (uses your distro's package manager).
        
    * Copies the `tuptime` binary to `/usr/bin/`.
        
    * Initializes the database (`/var/lib/tuptime/tuptime.db`).
        
    * Sets up cron jobs for updates.
        
    * Configures init hooks (Systemd/OpenRC) for boot/shutdown logging.
        

**Time to Install**: Under 30 seconds on a fresh Ubuntu/Debian box.  
**Requirements**: Root access, internet connection. Tested on Ubuntu 24.04, Debian 12, Fedora 41, Arch, and FreeBSD 14.

## Usage Examples | From Basic to Power User

### 1\. Basic Summary (Default)

```bash
tuptime
```

**Sample Output**:

```plaintext
System startups:       12
System shutdowns:      11
System life:           1 year, 2 months
Longest uptime:        45 days
Average uptime:        30 days
Current uptime:        5 days
Cumulative downtime:   2 weeks
```

### 2\. Table View (Per-Session Breakdown)

```bash
tuptime -t
```

**Output**:

```plaintext
#  Startup      Uptime     Shutdown    Downtime
1  2024-01-01   45d        2024-02-15  1h
2  2024-02-16   3d         2024-02-19  2h
...
```

### 3\. List View (Detailed)

```bash
tuptime -l
```

Detailed per-boot info, including kernel and boot ID.

### 4\. CSV Export (For Reporting)

```bash
tuptime --csv > uptime_report.csv
```

Pipe to `column -t` or import into spreadsheets.

### 5\. Raw Epochs (Scripting)

```bash
tuptime --epoch
```

Outputs Unix timestamps for automation.

### 6\. Filter Recent Sessions

```bash
tuptime -t --since 2025-01-01
```

## Supported Operating Systems and Compatibility

* **Linux**: All major distros (Ubuntu, Debian, Fedora, CentOS/RHEL, Arch, openSUSE). Systemd, OpenRC, SysVinit.
    
* **FreeBSD**: Native ports available.
    
* **macOS**: Experimental via Homebrew (not officially supported).
    
* **Python**: 3.6+ required.
    
* **Database**: SQLite3 (auto-created, ~1KB per entry).
    

No issues with containers (Docker), VMs, or multi-user setups.

## Maintaining and Troubleshooting Tuptime

* **Update Database**: Auto via cron; manual: `sudo tuptime -q`.
    
* **Reset Data**: `sudo rm /var/lib/tuptime/tuptime.db && sudo tuptime`.
    
* **View DB**: `sqlite3 /var/lib/tuptime/tuptime.db "SELECT * FROM tuptime;"`
    
* **Logs**: Check `/var/log/tuptime.log` for verbose mode (`tuptime -v`).
    
* **Common Fixes**:
    
    | Issue | Solution |
    | --- | --- |
    | No historical data | Run `sudo tuptime` initially |
    | Cron not updating | `sudo systemctl restart cron` |
    | NTP skew warnings | Enable `systemd-time-wait-sync` |
    | Permission errors | chown `tuptime:tuptime` on DB |
    

## Wrap | Level Up Your Uptime Game

Tuptime transforms a simple uptime check into a powerful analytics tool, all with **one line to install**. In under a minute, you'll have historical insights that save hours of manual logging. Whether you're a solo dev tracking a Raspberry Pi or an admin monitoring a data center, tuptime delivers reliability without complexity.

Ready to start? Fire up your terminal and run:

```bash
bash < <(curl -Ls https://git.io/tuptime-install.sh)
```

Then `tuptime`—watch the magic unfold.

For more, check the [full manual](https://github.com/rfmoz/tuptime/blob/master/tuptime-manual.txt) or join the community discussions on GitHub. Happy monitoring! 🚀

---

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1761406572299/c26f231b-1419-4819-b1cf-133b6686933e.png align="center")

Ronald Bartels | [LinkedIn](https://www.linkedin.com/in/ronaldxbartels/) | [Instagram](https://www.instagram.com/ron_mastelek/)

---

[Nepean Networks](https://nepeannetworks.com)

[The Hub & Spoke | SD-WAN Blog](https://hubandspoke.amastelek.com/)

[The Morning Patrol with Ron Mastelek 💪](https://ron1821.substack.com/)
