Skip to content
/ histop Public

Show your most frequently used bash/zsh commands in a visually appealing and easy-to-understand format.

License

Notifications You must be signed in to change notification settings

rodrgz/histop

Repository files navigation

histop

Linux (x86_64)
Build status for Linux
FreeBSD (x86_64)
Build status for FreeBSD

Uncover the hidden gems of your command history! This nifty program analyzes your shell history file and presents the most frequently used commands in a visually appealing and easy-to-understand format. With powerful options to filter out noise and focus on what matters.

Supported Shells

  • Bash (~/.bash_history)
  • Zsh (~/.zsh_history or ~/.config/zsh/.zsh_history)
  • Ash (~/.ash_history)
  • Fish (~/.local/share/fish/fish_history) — native support!

Usage

git clone https://git.sr.ht/~rodrgz/histop
cd histop
cargo build #or nix build
$ histop -h 
Usage: histop [options]
 -h, --help       Print this help message
 -f <FILE>        Path to the history file
 -c <COUNT>       Number of commands to print (default: 25)
 -a               Print all commands (overrides -c)
 -m <MORE_THAN>   Only consider commands used more than <MORE_THAN> times
 -i <IGNORE>      Ignore specified commands (e.g. "ls|grep|nvim")
 -b <BAR_SIZE>    Size of the bar graph (default: 25)
 -n               Do not print the bar
 -nh              Disable history mode (can be used for any data)
 -np              Do not print the percentage in the bar
 -nc              Do not print the inverse cumulative percentage in the bar
 -v               Verbose
 -F               Force fish history format parsing
 ██               Percentage
 ▓▓               Inverse cumulative percentage

Example

$ histop -c 10 -i "cd"
1184   │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█████│ 19.08%   ls
 943   │░░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████│ 15.19%   nvim
 792   │░░░░░░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓███│ 12.76%   git
 670   │░░░░░░░░░░░▓▓▓▓▓▓▓▓▓▓▓███│ 10.80%   nix
 311   │░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓▓█│  5.01%   rg
 310   │░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓█│  5.00%   exit
 255   │░░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓█│  4.11%   dust
 253   │░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓█│  4.08%   histop
 233   │░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█│  3.75%   cargo
 219   │░░░░░░░░░░░░░░░░░░░░▓▓▓▓█│  3.53%   man

Fish Shell

Fish is now natively supported! Just run histop from a Fish shell, or use -f to point to your fish_history:

$ histop -f ~/.local/share/fish/fish_history

For custom YAML-like history files compatible with Fish format, use -F to force parsing:

$ histop -F -f /path/to/custom/history

Testing

Running All Tests

cargo test

This runs all tests:

  • Unit tests (38 tests) — test individual functions in each module
  • Integration tests (14 tests) — test history parsing with fixture files
  • CLI tests (42 tests) — test all command-line options end-to-end

Running Specific Test Suites

# Unit tests only (in src/)
cargo test --lib

# Integration tests only
cargo test --test integration_test

# CLI tests only (requires binary to be built first)
cargo build && cargo test --test cli_test

Test Fixtures

Test fixtures are located in tests/fixtures/:

  • bash_history — sample bash history file
  • zsh_history — sample zsh extended history file
  • fish_history — sample fish history file (YAML format)

Requirements

  1. Rust 1.46 or later
  2. Cargo package manager

About

Show your most frequently used bash/zsh commands in a visually appealing and easy-to-understand format.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published