A collection of practical bash techniques — the stuff that’s actually useful day-to-day, not the stuff you forget after reading a 500-page book. I use all of this inside WSL and when managing my home server.
The Notes
- Keyboard Shortcuts — readline movements,
Ctrl+Rsearch,Alt+., and the cut/paste trick withCtrl+U/Ctrl+Y - History Expansion —
!!,!$, the typo fixer (^old^new), and previewing with:p - Variable Tricks — parameter expansion for path manipulation, string ops, defaults (
:-,:=,:?), and arrays - Brace Expansion —
{}for quick file ops, sequences, the backup trick (cp file{,.bak}), and nesting - Quick Loops — one-liner
forloops,while readfor safety, xargs for parallelism, and common footguns - Process Tricks — chaining (
&&,||), background jobs, subshells, process substitution, and handy one-liners
Where to Go First
If you’re just getting started, bash-keyboard-shortcuts and bash-history-expansion give you the most speed for the least effort. After that, bash-variable-tricks and bash-brace-expansion will change how you think about file manipulation. bash-quick-loops and bash-process-tricks round it out for automation.
Good External Resources
- Greg’s Wiki (BashGuide) — the best bash resource on the internet, period
- GNU Bash Manual — dense but complete
- Bash Hackers Wiki (archived) — great explanations, sadly archived now
See Also
- Oh My Zsh Plugins — the shell framework that wraps around all this
- WSL for Development — where I run bash daily
- Automate This (AI Prompt) — when you want to turn a bash idea into a real script fast