Terminal Aliases That Save Me Hours
The shell shortcuts I use daily - navigation, git, network diagnostics, and system commands.
Every command you type repeatedly is time wasted. Shell aliases turn long commands into short shortcuts. Here are the ones I actually use.
How Aliases Work
Add them to ~/.bashrc (Bash) or ~/.zshrc (Zsh):
alias ll='ls -la'
alias gs='git status'
Apply changes:
source ~/.zshrc
Now ll runs ls -la and gs runs git status.
Navigation
alias ..='cd ..'
alias ...='cd ../..'
alias home='cd ~'
alias c='clear'
Single characters for common operations.
Git
alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gp='git push'
alias gl='git log --oneline -10'
alias gd='git diff'
alias gco='git checkout'
I run gs dozens of times a day.
Network Diagnostics
These are the ones I reach for when troubleshooting:
# Show listening ports
alias ports='netstat -an | grep LISTEN'
# Local IP
alias myip='ipconfig getifaddr en0' # macOS
# alias myip='hostname -I | awk "{print \$1}"' # Linux
# Public IP
alias mypublicip='curl -s ifconfig.me'
# Quick ping (10 packets, fast)
alias p='ping -c 10 -i 0.2'
# DNS lookup
alias n='nslookup'
# ARP table
alias a='arp -a'
File Operations
# Create directory with parents
alias mkd='mkdir -p'
# Show disk usage for current directory
alias duh='du -h --max-depth=1 | sort -hr'
# Find large files
alias bigfiles='find . -type f -size +100M'
Quick Edits
# Edit and reload shell config
alias editz='vim ~/.zshrc && source ~/.zshrc'
# Show my aliases (assumes they're at end of file)
alias shortcuts='tail -30 ~/.zshrc'
Docker
alias d='docker'
alias dc='docker compose'
alias dps='docker ps'
alias dimg='docker images'
alias dlogs='docker logs -f'
Kubernetes
alias k='kubectl'
alias kgp='kubectl get pods'
alias kgs='kubectl get services'
alias kgd='kubectl get deployments'
alias klogs='kubectl logs -f'
Tips
Don't override system commands. Aliasing rm to rm -i seems safe until a script expects the original behavior.
Use descriptive names. gs for git status is easy to remember. x for something obscure isn't.
Chain with &&. alias editz='vim ~/.zshrc && source ~/.zshrc' ensures source only runs if editing succeeds.
Add comments. For complex aliases, add a comment above explaining what it does.
Key Takeaways
- Store aliases at the end of
.bashrcor.zshrcfor easy editing - Two-letter aliases (gs, gp, ll) are fast and memorable
- Network diagnostic aliases (ports, myip) get used constantly
- Run
source ~/.zshrcafter editing to apply changes - Avoid overwriting system commands
- Chain related commands with && for atomic operations
Written by Bar Tsveker
Senior CloudOps Engineer specializing in AWS, Terraform, and infrastructure automation.
Thanks for reading! Have questions or feedback?