Productive Zsh Alias Library
Intermediatev1.0.0
Build a comprehensive Zsh alias library for Git, Docker, npm, navigation, and system commands — with suffix aliases, global aliases, and naming conventions.
Content
Overview
Zsh aliases turn long, frequently-typed commands into short keywords. Beyond simple aliases, Zsh supports global aliases (expand anywhere in a command), suffix aliases (open files by extension), and named directory hashes for quick navigation.
Why This Matters
- -Save keystrokes —
gstinstead ofgit status - -Reduce errors — aliases encode correct flags and options
- -Standardize workflows — team-shared alias files
- -Zsh-exclusive features — global and suffix aliases
Core Alias Patterns
Git Aliases
Docker Aliases
Navigation Aliases
Global Aliases (Expand Anywhere)
Suffix Aliases (Open by Extension)
Best Practices
- -Prefix by tool:
gfor git,dfor docker,kfor kubectl - -Use consistent patterns:
gs= git status,ks= kubectl status - -Don't shadow system commands: use
alias llnotalias ls - -Split into files:
~/.zsh/aliases/git.zsh,~/.zsh/aliases/docker.zsh - -Document aliases: add comments for team-shared configs
- -Test with `type`:
type gsshows what an alias expands to
Common Mistakes
- -Aliasing over system commands without escape (
\commandfor original) - -Too many aliases to remember (stick to 20-30 most-used)
- -Global aliases in shared scripts (confusing for others)
- -Not sourcing alias files from .zshrc after creating them
FAQ
Discussion
Loading comments...