f7a83be00e84816e14dc685618d5987013f9640d
Shell History Alias Generator
A CLI tool that analyzes terminal command history to discover frequently used long commands and generates shell aliases.
Features
- Multi-shell Support: Parse history from Bash, Zsh, and Fish shells
- Smart Analysis: Calculate frequency scores and identify commands worth aliasing
- Interactive Review: Review suggested aliases before adding them
- Multi-format Export: Export to bashrc, zshrc, or fish formats
- Easy Installation: Direct installation to shell configuration files
Installation
pip install shell-history-alias-generator
Or from source:
pip install -e .
Usage
Analyze history and generate aliases
shell-alias-gen analyze
With a specific history file:
shell-alias-gen analyze ~/.bash_history --shell bash
Interactive mode
shell-alias-gen analyze --min-frequency 3
Export to file
shell-alias-gen analyze --export bash --output aliases.sh
Install directly to shell rc file
shell-alias-gen install --format bash
View supported shells
shell-alias-gen shells
Show history file locations
shell-alias-gen locations
Options
| Option | Description |
|---|---|
--shell |
Shell type: bash, zsh, fish, or auto |
--min-length |
Minimum command length (default: 15) |
--min-frequency |
Minimum command frequency (default: 2) |
--export |
Export format: bash, zsh, or fish |
--output |
Output file path for export |
--non-interactive |
Skip interactive review mode |
How It Works
- Parse History: Reads shell history files in shell-specific formats
- Analyze Commands: Counts command frequency and calculates complexity scores
- Generate Aliases: Creates short, meaningful alias names
- Review: Allows interactive review of suggested aliases
- Export: Outputs aliases in your shell's format
Alias Name Generation
Aliases are generated based on:
- First letters of command words (e.g.,
git checkout→gc) - Common keywords (e.g.,
docker,npm) - Minimum length and complexity requirements
License
MIT
Description
A CLI tool that analyzes terminal command history to discover frequently used long commands and generates shell aliases
Languages
Python
100%