Terminal Productivity: Create Aliases for Frequent Commands
Save hours of typing by creating shell aliases for long commands. Simple but incredibly effective.
Technologies Discussed
Stop Typing Long Commands
We all have that one command we type dozens of times a day. Terminal aliases are the solution.
What Are Aliases?
Aliases are shortcuts for longer commands. Instead of typing a long command, you type a short alias.
Creating Aliases
### Temporary Alias (Current Session Only)
bash
alias ll='ls -lah'
Now type 'll' instead of 'ls -lah'.
### Permanent Alias (All Sessions)
Edit your shell configuration file:
**For Bash:**
bash
# Edit ~/.bashrc
alias ll='ls -lah'
alias gs='git status'
alias gc='git commit'
alias ga='git add'
alias gp='git push'
**For Zsh:**
bash
# Edit ~/.zshrc
alias ll='ls -lah'
alias gs='git status'
**For Fish:**
bash
# Edit ~/.config/fish/config.fish
alias ll 'ls -lah'
alias gs 'git status'
Real World Examples
### Git Aliases
bash
alias gs='git status'
alias gc='git commit -m'
alias ga='git add .'
alias gp='git push'
alias gpl='git pull'
alias gl='git log --oneline -10'
alias gb='git branch'
alias gd='git diff'
### Development Aliases
bash
alias dev='npm run dev'
alias build='npm run build'
alias test='npm test'
alias start='npm start'
alias ll='ls -lah'
alias cd..='cd ..'
alias ..='cd ..'
### Project Shortcuts
bash
alias myproject='cd ~/projects/myproject && code .'
alias blog='cd ~/projects/portfolio && npm run dev'
Advanced: Functions as Aliases
For more complex shortcuts, use functions:
bash
# Create a new Next.js project
newapp() {
npx create-next-app@latest "$1" --typescript
}# Usage: # newapp my-project
Checking Your Aliases
bash
# List all aliases
alias# Check specific alias alias gs
# Remove an alias unalias gs
Pro Tips
1. **Keep common aliases short** - 'll' instead of 'lah' - 'gs' instead of 'git status'
2. **Be consistent across projects** - Use same aliases everywhere - Build muscle memory
3. **Document your aliases** - Add comments to your config file - Share with team for consistency
4. **Don't alias dangerous commands** - Don't alias 'rm' to something shorter - Safety first!
Reload Aliases After Changes
bash
# Bash
source ~/.bashrc# Zsh source ~/.zshrc
# Fish source ~/.config/fish/config.fish
Productivity Impact
With 10 aliases used 5 times daily: - Time saved: 10 min/day - Per month: 200 min - Per year: 2400 min (40 hours!)
That's a week of productivity!
Conclusion
Terminal aliases are deceptively powerful. They reduce typing, improve speed, and make you more efficient. Start with a few common ones and build from there.