t_trace 🚀 
t_trace is a high-performance, command-line statistics tracker for your shell.
It silently observes your command-line usage and provides fast, insightful statistics on which commands you run, how often you run them, and how long they take, all with a negligible performance impact on your interactive shell.
Demo
t_trace collects statistics in the background and lets you view them instantly with the stats command.
Features
- ⚡️ Blazing Fast: Written in Rust with a client-daemon architecture over a Unix Domain Socket. The shell hooks are incredibly lightweight and exit in microseconds, ensuring zero perceived lag in your terminal.
- 📊 Insightful Stats: Tracks execution count, total time, mean time, last run time, and success/failure rates for every command.
- ✨ Seamless Integration: A simple, one-line eval command is all you need to hook
t_traceinto your shell. The daemon starts automatically and manages itself. - 💾 Robust & Persistent: The daemon process runs reliably in the background. It saves state gracefully on shutdown, so your statistics survive reboots.
How to use
You need the Rust toolchain installed on your system. If the toolchain is ready, you need to complete two steps: installation and one-time setup.
Installation
a) From Crates.io (Recommended)
b) From Source (Alternative)
One-Time Setup
To hook t_trace into your shell, add the following line to the end of your ~/.bashrc:
Then, either restart your shell or run source ~/.bashrc to apply the changes.
That's it! t_trace will now start automatically with your shell session and begin tracking commands.
How It Works
t_trace uses a performant client-daemon architecture to avoid slowing down your shell.
- The Daemon: A single background process acts as the "brain". It listens on a Unix Domain Socket, manages all in-memory state, aggregates statistics, and handles saving data to disk.
- The Client: An extremely lightweight binary invoked by your shell's hooks (trap
DEBUGandPROMPT_COMMAND). Its only job is to send a tiny message to the daemon and exit immediately. - Communication: All communication happens over a high-speed, low-latency Unix Domain Socket, which avoids network overhead and is perfect for local inter-process communication.
License
This project is dual-licensed under the terms of both the MIT license and the Apache License 2.0. You may choose to use it under either license.