Shellist
Parse shell history (bash, zsh, fish), count commands, and rank them by frequency. Library and CLI.
Install
CLI
|
Input
| Flag | Description |
|---|---|
--path PATH |
Read history from PATH instead of the default file |
--shell bash|zsh|fish |
Force a parser (default: auto-detect from contents) |
- |
Read from stdin (or just pipe history in) |
By default shellist reads ~/.bash_history. With --shell zsh/fish it uses
~/.zsh_history / $XDG_DATA_HOME/fish/fish_history. Otherwise the format is
auto-detected from the file contents.
Filtering
| Flag | Description |
|---|---|
--top N |
Show only the top N commands |
--ignore X,Y |
Exclude commands (comma-separated) |
--no-default-ignore |
Don't filter bash internals (set, shopt) |
--min N |
Only commands used at least N times |
--grep PATTERN |
Keep commands matching a regex (case-insensitive) |
--depth N |
Treat the first N tokens as the command key (default 1) |
--since DATE |
Only on/after DATE (YYYY-MM-DD, needs timestamps) |
--until DATE |
Only on/before DATE (YYYY-MM-DD, needs timestamps) |
--asc |
Sort ascending |
By default, set and shopt are ignored — these are bash internals that often leak into .bash_history from shell init scripts, not commands you actually typed. Use --no-default-ignore to see them.
Output
| Flag | Description |
|---|---|
--bars |
Add an ASCII bar chart column |
--percent |
Add a percentage column |
--json |
Output as a JSON array |
--csv |
Output as CSV |
--stats |
Print summary statistics |
--trend |
Show usage bucketed over time (UTC, needs timestamps) |
--trend-bucket day|week|month |
Bucket granularity for --trend (default day). Also daily,weekly,monthly |
--output FILE |
Write output to FILE instead of stdout |
Integration
| Flag | Description |
|---|---|
--completions bash|zsh|fish |
Print a shell completion script |
--man |
Print the man page |
--help |
Print help |
Install completions, for example for bash:
Example output:
Rank Command Count Pct Bars
---- ------- ----- ----- ------------------------------
1 ls 120 40.0% ##############################
2 git 95 31.7% #######################
3 cd 80 26.7% ####################
Library
use ;
// Full pipeline
let ranked = analyze;
assert_eq!;
// Step by step
let entries = parse_history;
let counts = count_commands;
let ranked = rank_commands;
let top = top_n;
let filtered = filter_commands;
// From file
let content = load_history_file?;
Multi-shell parsing
use ;
let zsh_entries = new.parse;
assert_eq!;
let fish_entries = new.parse;
let shell = detect_shell;
Benchmarks
Runs criterion benchmarks on analyze() with 100, 1k, 10k, and 100k history entries. Results
are written to target/criterion/ with HTML reports.
To compare against a baseline:
# make changes...
License
MIT