Bash vs Zsh
The traditional Unix shell versus its feature-rich successor that is now the macOS default.
Bash (Bourne Again Shell) is the traditional default shell on most Linux distributions with broad compatibility, while Zsh (Z Shell) extends Bash's capabilities with better autocompletion, globbing, theming, and plugin support. Zsh became the default shell on macOS starting with Catalina. Both are POSIX-compatible and handle everyday shell tasks similarly, with Zsh offering a more polished interactive experience and Bash offering maximum portability for scripts.
Bash
Bash (Bourne Again Shell) is the most widely used Unix shell, serving as the default on most Linux distributions and macOS versions before Catalina. Created by Brian Fox for the GNU Project, Bash is a superset of the original Bourne shell (sh) with additions like command history, tab completion, arrays, and arithmetic evaluation. Bash scripts are the lingua franca of Unix automation: init scripts, CI/CD pipelines, cron jobs, and deployment scripts are overwhelmingly written in Bash. Its ubiquity means Bash scripts run on virtually any Unix-like system without modification. Bash's interactive features are functional but basic compared to modern alternatives: simple tab completion, basic history search (Ctrl+R), and limited prompt customization. For scripting portability and system compatibility, Bash remains the safe default choice.
Zsh
Zsh (Z Shell) is an extended Bourne shell with significant improvements for interactive use and scripting. Created by Paul Falstad, Zsh includes features from Bash, ksh, and tcsh while adding its own innovations: advanced tab completion with descriptions and menu selection, recursive globbing (**), spelling correction, shared command history across sessions, and extensive prompt theming. The Oh My Zsh framework and its ecosystem of plugins and themes have made Zsh the shell of choice for developers who value a polished terminal experience. Apple made Zsh the default shell on macOS starting with Catalina (2019). Zsh is largely compatible with Bash syntax, making migration straightforward for most users. Its completion system is particularly powerful, offering context-aware suggestions for command options, file paths, git branches, and more.
Key Differences
- **Tab completion**: Zsh offers context-aware completion with descriptions, menu navigation, and fuzzy matching. Bash has basic programmable completion. - **Globbing**: Zsh supports recursive globbing (**), qualifier-based globbing (e.g., selecting files by type or date), and extended patterns natively. Bash requires shopt settings for some features. - **Plugin ecosystem**: Zsh has Oh My Zsh, Prezto, and a rich plugin ecosystem for themes, git integration, and productivity tools. Bash has fewer community frameworks. - **Prompt customization**: Zsh prompts are highly customizable with themes like Powerlevel10k. Bash prompts require manual PS1 configuration. - **Portability**: Bash is available on virtually every Unix system by default. Zsh must be installed separately on many Linux distributions. - **Scripting**: Both are capable scripting shells. Bash is the safer choice for scripts intended to run on diverse systems.
When to Use Each
**Use Bash** for writing portable shell scripts that will run on many different systems, for system administration scripts on servers (where Bash is the guaranteed default), and for CI/CD pipeline scripts where you want maximum compatibility. **Use Zsh** as your interactive daily shell when you want better autocompletion, plugin support, theming, and quality-of-life features. It is especially recommended on macOS where it is already the default. **Tip**: many developers use Zsh for their interactive terminal and write scripts with a #!/bin/bash shebang for portability.
Analogy
**Bash** is like a reliable utility truck: it gets the job done everywhere, every time. It is not fancy, but it is dependable, and every mechanic knows how to work on it. **Zsh** is like the same truck with a premium interior package: upgraded dashboard, better navigation, comfortable seats, and quality-of-life additions. The engine is essentially the same, but the driving experience is noticeably more pleasant.