Safe, explainable shell history cleanup in Go.
- First-class zsh history support, including zsh-metafied command decoding
- Dry-run by default for safe previews
- Explain every removal with rule-based reasons
- Remove duplicates while keeping the latest occurrence
- Drop entries by literal text, regex, line number, or timestamp range
- Create backups before writes and support restore
- Text and JSON reports
Install from GitHub Releases:
tar -xzf histprune_<tag>_<os>_<arch>.tar.gz
./histprune --helpOr build from source:
go install github.com/walker1211/histprune/cmd/histprune@latest
histprune --helpAnalyze your default zsh history file:
histprune analyzePreview cleanup first:
histprune prune --dedupeApply the cleanup after reviewing the preview:
histprune prune --dedupe --writeBy default, histprune uses $HISTFILE, then falls back to ~/.zsh_history. Use --file PATH only when you want to target another history file.
After writing changes to an active zsh history file, reload it in your current shell:
fc -R ~/.zsh_historyShow all commands and flags:
histprune --helpLicensed under the MIT License. See LICENSE.