A lightweight, fast CLI tool for managing shell aliases directly in your .zshrc or .bashrc files.
- Simple Commands: Easy-to-use interface for managing aliases
- Direct File Manipulation: Works directly with your dotfiles - no separate database
- Automatic Backups: Creates
.bakfiles before any modification for safety - Shell Detection: Automatically detects whether you're using bash or zsh
- Search Functionality: Filter aliases by name
- Preserves Structure: Maintains all comments, blank lines, and file organization
- Zero Dependencies: Single binary with no runtime dependencies
- Cross-Platform: Works on macOS, Linux, and other Unix-like systems
# One-step install
brew install navio/tap/am
# Or tap first, then install
brew tap navio/tap
brew install am# Clone the repository
git clone https://github.com/navio/am.git
cd am
# Build the binary
go build -o am
# Move to a directory in your PATH
sudo mv am /usr/local/bin/
# Or install to Go's bin directory
go installDownload the latest release for your platform from the releases page.
Run this command once to enable auto-sourcing:
am initThis adds a shell wrapper function to your .zshrc, .bashrc, or config.fish that automatically reloads your shell configuration after adding, updating, or deleting aliases. After running am init, restart your shell or run:
source ~/.zshrc # for zsh
source ~/.bashrc # for bash
source ~/.config/fish/config.fish # for fishFrom this point forward, all alias changes take effect immediately!
am add ll 'ls -la'
am add gs 'git status'
am add serve 'python -m http.server 8000'am listOutput:
All aliases (3 total):
ll → ls -la
gs → git status
serve → python -m http.server 8000
am list gitOutput:
Aliases matching 'git' (1 found):
gs → git status
am update ll 'ls -lah'am delete serveam --help
am add --helpam --versionAlias Manager works directly with your shell configuration files:
- Shell Detection: Automatically detects your shell (
$SHELLenvironment variable) - File Location: Finds the appropriate dotfile:
- Zsh:
~/.zshrc - Bash:
~/.bashrc - Fish:
~/.config/fish/config.fish
- Zsh:
- Safe Modifications: Creates a
.bakbackup before any write operation - Structure Preservation: Only modifies alias lines, preserving everything else
| Command | Description | Example |
|---|---|---|
am init |
Initialize auto-sourcing wrapper (run once) | am init |
am add <name> <command> |
Add a new alias | am add ll 'ls -la' |
am list [search] |
List all aliases, optionally filtered | am list git |
am update <name> <command> |
Update an existing alias | am update ll 'ls -lah' |
am delete <name> |
Delete an alias | am delete ll |
am --version |
Show version | am --version |
am --help |
Show help | am --help |
# Add common git aliases
am add gs 'git status'
am add gc 'git commit -m'
am add gp 'git push'
am add gl 'git log --oneline --graph'
# Add navigation aliases
am add .. 'cd ..'
am add ... 'cd ../..'
am add home 'cd ~'
# Add utility aliases
am add serve 'python -m http.server 8000'
am add ports 'lsof -i -P | grep LISTEN'# Find all git-related aliases
am list git
# Update an alias
am update gs 'git status -sb'
# Remove unused aliases
am delete serve- Automatic Backups: Every modification creates a
.bakfile - Duplicate Detection: Prevents adding aliases that already exist
- Validation: Checks for valid alias names (alphanumeric, underscore, hyphen only)
- Atomic Writes: Uses temporary files to ensure safe writes
- Structure Preservation: Never removes comments or formatting
If something goes wrong, your backup file is always available:
# For zsh users
cp ~/.zshrc.bak ~/.zshrc
source ~/.zshrc
# For bash users
cp ~/.bashrc.bak ~/.bashrc
source ~/.bashrc
# For fish users
cp ~/.config/fish/config.fish.bak ~/.config/fish/config.fish
source ~/.config/fish/config.fishIf you've run am init, changes apply automatically! No manual sourcing needed.
If you haven't initialized the auto-source wrapper, manually reload your shell:
# For zsh
source ~/.zshrc
# For bash
source ~/.bashrc
# For fish
source ~/.config/fish/config.fish
# Or simply start a new shell session- Go 1.21 or later
# Clone the repository
git clone https://github.com/navio/am.git
cd am
# Install dependencies
go mod download
# Build
go build -o am
# Run tests
go test ./...
# Run tests with coverage
go test ./... -coveram/
├── cmd/ # CLI commands
│ ├── root.go # Root command
│ ├── add.go # Add command
│ ├── list.go # List command
│ ├── delete.go # Delete command
│ └── update.go # Update command
├── internal/
│ ├── alias/ # Alias management logic
│ │ ├── models.go # Data structures
│ │ ├── parser.go # Alias parsing
│ │ └── manager.go # CRUD operations
│ ├── dotfile/ # File I/O with backups
│ │ └── handler.go
│ └── shell/ # Shell detection
│ └── detector.go
├── main.go # Entry point
└── *_test.go # Tests
# Run all tests
go test ./...
# Run with verbose output
go test ./... -v
# Run with coverage
go test ./... -cover
# Generate coverage report
go test ./... -coverprofile=coverage.out
go tool cover -html=coverage.out- Zsh (
.zshrc) - Bash (
.bashrc) - Fish (
~/.config/fish/config.fish)
- Only works with bash, zsh, and fish
- Aliases must be in the format:
alias name='command' - Does not support multi-line aliases (with backslash continuation)
- Does not support alias functions or complex shell scripting
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details
Created by navio