Skip to content

ZSH vs SH vs Bash: A Complete Linux Shell Comparison

ZSH, SH, and Bash are the most common Linux shells. Learn their feature differences, their history, and a full comparison table at the bottom of this article.

If you often open a terminal on Linux or macOS, you've surely heard the term shell. But three names come up most often — SH, Bash, and ZSH — and more than a few people struggle to tell them apart. This article explains all three in full, from history to features, with a comparison table at the end.

What Is a Shell?

A shell is the program that reads the commands you type in the terminal, executes them, and displays the result. Every command like ls, cd, or grep is actually processed by the shell.

echo "Hello, shell!"

There are many shells — Bourne shell, C shell, Korn shell, Fish, and more — but the three most commonly used are SH, Bash, and ZSH.

SH — Bourne Shell

History: The oldest shell, created by Stephen Bourne at Bell Labs in 1977 for Unix version 7. The POSIX shell syntax standard still used today started here.

SH characteristics:

  • Simple and minimal — only basic features
  • Present on almost every Unix/Linux system, making sh scripts the most portable
  • No built-in tab completion, limited history, prompt not customizable
  • Ideal for system scripts that must run anywhere

Important note: on many modern Linux distros (especially Debian and Ubuntu), /bin/sh is not the original Bourne shell but dash — a lightweight shell built for faster system boot. Scripts with the shebang #!/bin/sh still run fine because the POSIX syntax is the same.

#!/bin/sh
echo "This script runs on any POSIX shell"

Bash — Bourne Again Shell

History: Created by Brian Fox for the GNU project in 1989 as a replacement (and improvement) for the Bourne shell. The "again" in Bourne Again Shell refers to its predecessor. Bash is the default shell on almost every Linux distro.

Compared to SH:

  • Fully compatible with sh syntax — sh scripts run unchanged in Bash
  • Adds many interactive features missing from sh
  • Tab completion, command history with arrow keys, history search with Ctrl+R
  • Arrays, command substitution $(), [[ ]] conditions, here-strings, aliases, and job control
  • Customizable prompt via PS1
#!/bin/bash
# Typical bash feature: arrays
fruits=("apple" "orange" "banana")
echo "${fruits[1]}"

ZSH — Z Shell

History: Created by Paul Falstad in 1990 while studying at Princeton. Zsh combines the best of Bash, Korn shell (ksh), and tcsh. Since macOS Catalina (2019), Zsh has replaced Bash as Apple's default shell.

Compared to Bash:

  • Compatible with Bash syntax — most Bash scripts run in Zsh
  • The best tab completion in the shell class: context-aware, can complete command options, and shows menus
  • Autocorrect: suggests fixes when you mistype a command
  • Advanced globbing: **/*.txt searches files recursively
  • Massive plugin ecosystem via oh-my-zsh and prompts like Starship
  • History sharing across open terminals, command spell-checking, and extremely flexible prompt themes
#!/bin/zsh
# Typical zsh feature: recursive glob search
ls **/*.log

Check Your Current Shell

The following commands show your active shell and your account's default shell:

echo $SHELL        # default shell of this account
echo $0            # shell currently running
cat /etc/passwd | grep $(whoami)

Feature Comparison

A brief summary of their differences:

  • SH is the lightest and the most portable, but very light on interactive features.
  • Bash is the balanced one: compatible with sh, feature-rich, and available everywhere — the safest shell for Linux beginners.
  • ZSH is the most advanced and most comfortable for heavy daily use, at the cost of a slightly heavier startup.

SH vs Bash vs ZSH Comparison Table

Aspect SH Bash ZSH
Full name Bourne Shell Bourne Again Shell Z Shell
Released 1977 1989 1990
Author Stephen Bourne (Bell Labs) Brian Fox (GNU) Paul Falstad (Princeton)
License proprietary (original) GPL MIT-like
Compatible with sh scripts Yes (the original) Yes Yes
Tab completion Not built-in Yes Best (menu, context-aware)
Command history Limited Yes Advanced (sharing across terminals)
Arrays No Yes Yes
Plugins & themes None Limited Huge (oh-my-zsh, Starship)
Prompt customization Minimal Yes (via PS1) Outstanding
Default shell POSIX standard (on Debian/Ubuntu: dash) Linux (most distros) macOS (Catalina+)
Best for Portable system scripts General Linux use Power users
Main strength Lightweight, universal Balanced, highly available Best interactive features
Main weakness Light on interactive features Less flashy than zsh Heavier startup

Tip: for scripts that must run across distros, use sh syntax (shebang #!/bin/sh). For daily use, Bash is safe and sufficient; to maximize terminal productivity, migrate to Zsh.

Read next