Blog
3 min read

zsh vs bash: What's the Difference and Which Should You Use?

bash and zsh are both shells — the programs that read your terminal commands. Why macOS switched to zsh, the differences you'll actually notice (config files, completion, globbing, arrays), Oh My Zsh, and why scripts should usually still be written for bash.

When you open a terminal, the program reading your commands is a shell. The two you'll meet most are bash and zsh. For everyday commands they behave almost identically. (The terminal for complete beginners)

Which one am I using?

echo $SHELL
  • macOS (since Catalina, 2019): zsh by default.
  • Most Linux distributions and servers: bash.
  • Windows: PowerShell or Command Prompt; Git Bash and WSL give you bash. (What is WSL?)

Apple switched to zsh largely for licensing reasons: newer bash versions use GPLv3, so macOS shipped a very old bash 3.2 for years.

Differences you'll notice

Config files

bash zsh
Interactive settings, aliases ~/.bashrc ~/.zshrc
Login shell ~/.bash_profile ~/.zprofile

This is the #1 source of confusion. A tutorial says "add this to ~/.bashrc", you're on zsh, nothing happens. On a Mac, use ~/.zshrc. After editing, run source ~/.zshrc or open a new terminal. (Command not found and the PATH variable)

Tab completion

zsh's completion is more powerful out of the box: it can complete command options, Git branches, and lets you cycle through matches with a menu. bash completes too, with fewer extras unless configured.

Globbing (wildcards)

zsh has extended patterns, like **/*.js for all JavaScript files in all subfolders (bash needs shopt -s globstar). And by default, if a wildcard matches nothing, zsh errors (no matches found) while bash passes the pattern through literally. That's why this fails in zsh:

pip install requests[security]   # zsh: no matches found
pip install 'requests[security]' # ✅ quote it

Arrays

bash arrays start at index 0; zsh arrays at 1. Only matters if you write scripts.

Prompt and plugins

zsh has a big ecosystem of themes and plugins, most famously Oh My Zsh (themes, Git info in the prompt, aliases) and prompts like Powerlevel10k or the cross-shell Starship. Nice, but optional — and heavy plugin setups can slow terminal start-up.

Side by side

bash zsh
Default on Linux servers, Git Bash, WSL macOS
Everyday commands Same Same
Completion Good Better
Customisation Moderate Extensive
Scripting portability The standard Less common on servers

For scripts, write bash

Even if you use zsh interactively, write scripts for bash (or plain sh) with a shebang at the top:

#!/usr/bin/env bash
set -euo pipefail

Servers, Docker images and CI runners almost always have bash; many don't have zsh. The shebang means the script runs in bash no matter which shell you typed it from. (Bash scripting for beginners)

What about fish?

fish is another shell, very friendly out of the box (suggestions as you type, syntax highlighting), but its scripting syntax isn't bash-compatible. Pleasant for interactive use; still write scripts in bash.

Which should you use?

  • On a Mac: keep zsh. It's the default and works great.
  • On a Linux server: bash, which is what's there.
  • For scripts: bash.
  • Want it prettier: add Starship or Oh My Zsh — optional.

The skills transfer almost entirely between the two.


EasySpawn gives you a bash terminal on a Linux server from any browser — the same environment your app runs in. See how it works or join the waitlist.

Related: The Terminal for Complete Beginners · Bash Scripting for Beginners · What Is a CLI? · What Is Homebrew?

Keep reading