Dotfiles are the configuration files that define your shell environment, and a well-curated set of aliases and scripts can save significant time every day. I have been collecting shell aliases and tiny scripts for years. Here are the ones I actually use daily.
Git Shortcuts
# Quick status + branch info
alias gs='git status -sb'
# Pretty log with graph
alias gl='git log --oneline --graph --decorate -20'
# Amend last commit without editing message
alias gamend='git add -A && git commit --amend --no-edit'
# Interactive rebase on last N commits
gri() { git rebase -i HEAD~${1:-5}; }
# Delete merged branches
alias gclean='git branch --merged | grep -v "main\|master\|\*" | xargs -n 1 git branch -d'
Navigation and File Management
# Jump to project root (nearest .git directory)
alias root='cd $(git rev-parse --show-toplevel 2>/dev/null || echo ".")'
# Make directory and cd into it
mkcd() { mkdir -p "$1" && cd "$1"; }
# Find files by name (faster than find for most cases)
ff() { find . -name "*$1*" -not -path './node_modules/*'; }
# Quick server for current directory
alias serve='python3 -m http.server 3000'
Development Utilities
# Kill process on port
killport() { lsof -ti:$1 | xargs kill -9 2>/dev/null || echo "No process on port $1"; }
# Node project quick start
alias nr='npm run'
alias ni='npm install'
# Docker cleanup
alias dprune='docker system prune -af --volumes'
# Pretty JSON from clipboard
alias jsonpretty='pbpaste | python3 -m json.tool | pbcopy && echo "Formatted"'
How to Build Your Own Dotfiles
The key is not having hundreds of aliases. It is having a few that match your actual workflow. Start by noticing which commands you type most often, then alias those. Your future self will thank you.
Store your dotfiles in a Git repository so you can sync them across machines. Many developers host their dotfiles on GitHub for easy setup on new environments.
Key Takeaways
- Dotfiles are configuration files (.bashrc, .zshrc) that customize your shell environment - Git aliases like gs, gl, and gamend eliminate repetitive typing in daily workflows - Navigation helpers like root and mkcd reduce directory management friction - The killport function solves the common problem of orphaned processes blocking ports - Start with a few aliases that match your actual workflow, not hundreds you will forget - Store dotfiles in a Git repository to sync across machines - Review and update your aliases quarterly as your workflow evolves