termstat

Crates.iotermstat
lib.rstermstat
version0.1.1
created_at2025-11-26 15:30:55.246917+00
updated_at2025-11-26 17:24:56.337441+00
descriptionA CLI tool to get information about your terminal command usage history
homepage
repositoryhttps://github.com/marc55s/termstat
max_upload_size
id1951556
size176,877
Marc (Marc55s)

documentation

README

💻 Termstat - A tracker for Commands !!!(Still in development)!!!

A complete local command tracker, no Cloud involved. Feel free to try it, but keep in mind, that some things may break in following updates.

How it works

  1. A Shell prehook logs all commands into a logfile
  2. If the sync command is called the logfile entries are inserted into a Sqlite database

Installation

  • Nix
    • Systemd
  • Cargo
  • From Source

Shell prehook

Add the following to your .zshrc

eval "$(termstat init --shell-type zsh)"

Nix

Install nix and configure terstat via Homemanager

# flake.nix

# add input
inputs = {
    termstat = {
        url = "github:marc55s/termstat";
        inputs.nixpkgs.follows = "nixpkgs-unstable";
    };
}
# add overlay to your outputs
outputs = inputs@{self, nixpkgs, termstat ... }:
    pkgs = import nixpkgs {
        inherit system;
        overlays = [ inputs.termstat.overlays.default];
    }

# home.nix
{termstat, ...}:
{
    programs.termstat = {
        enable = true;
        enableZshIntegration = true;
        systemd = {
            enable = true;
            onCalendar = "DayOfWeek Year-Month-Day Hour:Minute:Second";  # defaults to daily
        }

        # Not supported yet
        # enableBashIntegration = true;
        # enableFishIntegration = true;
        # enableIonIntegration = true;
        # enableNushellIntegration = true;
    };

    # add the modules to your imports
    imports = [termstat.homeManagerModules.default];
}

Usage

After the initalization the following commands are available:

Help

Sync with database

Statistics

For the statistics these other commandflags are available:

termstat stats # default to termstat stats --daily/-d
termstat stats --weekly/-w
termstat stats --monthly/-m

Currently Supported Shells

  • Zsh
  • Bash
  • Fish
  • ...

Commands

  • sync
  • stats --daily, --weekly, --monthly
  • init --shell-type [SHELL]
  • clean

To Do

  • Switch from flags to subcommands
  • List available Commands
  • Systemd service for syncing automatically
  • Nix Packaging / Module
  • Support multiple Shelltypes
  • Display statistics in a fancy way with a TUI-Lib
  • Write Installation Manual
  • Publish to Crates.io
  • Far future: Support for multiple databases / Syncing across devices

Queries

  • Most used command of the day|week|month
  • Commands sorted by length
  • Common command pipes
  • Top exectued binaries
Commit count: 0

cargo fmt