Skip to content
Light Dark

Z shell vs Bash: Which Shell Reigns Supreme?

- 5 mins

Updated March 2026: Zsh is now the default shell on macOS since Catalina (10.15) and adopted by more Linux distributions. Oh My Zsh continues to thrive. The comparison and tips below are still accurate.

TL;DR: Why Zsh Might Be Your Next Shell

The Z shell (Zsh) offers several compelling advantages over the traditional Bourne-again shell (Bash):

  • Smart autocompletion for commands, options, and arguments
  • Shared command history across all running shells
  • Advanced file globbing without needing external programs like find
  • Floating-point arithmetic support (Bash only handles integers)
  • Spelling correction for mistyped commands
  • Themeable prompts with right-side information that auto-hides
  • Named directories for custom shortcuts like ~mydir

💡 Pro tip: For scripting that needs to be portable, stick with POSIX-compliant syntax. Zsh supports all Bash functionality, so your Bash scripts will work without modification.

A Tale of Two Shells

Some years ago, I switched from Bash to Zsh. At first, I felt lost - just as anyone would when leaving behind years of customized configurations, aliases, and functions. In my search for a quick setup, I discovered Oh My Zsh, an open source framework that made the transition painless with its pre-built themes and plugins.

Feature Comparison

FeatureZshBash
First Released19901989
Default Shell OnmacOS 10.15+, Deepin, GoboLinuxMost Linux distros, macOS 10.3–10.14
LicenseMIT-styleGPL
ConfigurabilityExtensive (variables, options, functions, styles)Basic (variables and options)
Floating Point Math✅ Yes❌ No
Auto-correction✅ Yes❌ No
Syntax Highlighting✅ Via extensions❌ No

Zsh in Action

Smart Completions and Corrections

The following animation demonstrates Zsh’s intelligent completion and auto-correction capabilities:

Zsh auto-suggestions in action

Powerful Globbing

Find all Sass files recursively with a simple pattern:

$ echo **/*\.sass
_sass/base/general.sass _sass/base/helpers.sass _sass/base/syntax.sass _sass/base/variables.sass _sass/components/author.sass _sass/components/disqus.sass _sass/components/footer.sass _sass/components/header.sass _sass/components/nav.sass _sass/components/others.sass _sass/components/pagination.sass _sass/components/related.sass _sass/components/share.sass _sass/components/side-by-side.sass _sass/components/social-links.sass _sass/components/spoiler.sass _sass/pages/home-blog-projects.sass _sass/pages/page.sass _sass/pages/post.sass _sass/pages/tags.sass

Suffix Aliases

Open files directly with associated applications:

$ alias -s markdown=vim
$ ./_posts/2018-06-14-vim-safe.markdown
# Opens the markdown file directly in vim

Advanced File Filtering

Find files modified more than 100 days ago:

$ ls -tld *(m+100)
-rw-rw-r-- 1 antenore antenore   117 Jun 16  2018 _config-dev.yml
-rw-rw-r-- 1 antenore antenore   212 Jun 16  2018 Rakefile
# ... more files

Floating-Point Arithmetic

Unlike Bash, Zsh handles floating-point calculations natively:

$ echo $((0.5 / 0.2))
2.5

Getting Started with Zsh

The easiest way to dive into Zsh is with Oh My Zsh. It provides a rich collection of plugins, themes, and functions with minimal setup effort:

  1. Install Zsh (if not already installed)
  2. Install Oh My Zsh with their one-line installer
  3. Explore the included themes and plugins

🔍 Tip: After setting up Oh My Zsh, take some time to read man zshall to discover Zsh’s full potential.

Essential Resources

Documentation

Learning

Community

  • ZSH-Wiki - Community-maintained wiki
  • IRC: #zsh at irc.freenode.org - Get help in real-time

Watch Out

Things that tripped me up during the switch, and still trip people today:

  • Oh My Zsh adds 200-400ms startup time. On a fresh install it’s fine. After 20 plugins and a fancy theme, your terminal takes a visible pause to open. Profile your startup with zsh -xv if things feel slow. Consider lazy-loading plugins or switching to a lighter framework like zinit.

  • Zsh globbing requires setopt GLOB_DOTS for dotfiles. The **/*.md pattern from the examples above won’t match .hidden/file.md by default. If you’re using globs to find config files, you’ll miss dotfiles unless you set this option.

  • Floating-point math doesn’t port to Bash. If you write a script using $((0.5 / 0.2)) and someone runs it with Bash, they get a syntax error. For portable scripts, stick to integer arithmetic or use bc.

  • Shared history has a race condition. If you have 10 terminals open and all writing history simultaneously, entries can get lost or duplicated. Set setopt HIST_SAVE_NO_DUPS and setopt INC_APPEND_HISTORY to minimize this, but don’t rely on history as an audit log.

  • Suffix aliases can be confusing in shared environments. If you set alias -s py=vim, typing script.py opens it in vim instead of running it. Colleagues sharing your dotfiles will be very confused.

Your Turn

Have you made the switch to Zsh? Share your favorite features or custom configurations in the comments below!


Some content adapted from Wikipedia.

Antenore Gatta

Antenore Gatta

A proud and busy Hacker, Father and Kyndrol

Did This Help Your Switch?

If this comparison helped you decide on your shell setup, consider supporting the blog.

Most readers scroll past. Less than 3% of readers contribute to keeping independent technical content free and accessible.

Post comment

Markdown is allowed, HTML is not. All comments are moderated.