What is ZSH, and Why Should You Use It Instead of Bash?

Trending 2 months ago

Well, it has much colors.

The Bash ammunition connected Ubuntu. Hannah Stryker / How-To Geek

Key Takeaways

  • ZSH, an extended type of nan Bourne Shell, offers caller features, specified arsenic automatic cd, pronunciation correction, themes, and plugins.
  • Installing ZSH connected Ubuntu aliases different Debian-based distros is arsenic elemental arsenic moving "sudo apt instal zsh" and changing nan default ammunition utilizing "chsh -s $(which zsh)."
  • To instal ZSH connected Fedora, "run sudo dnf instal zsh" past move nan ammunition by entering "zsh" successful nan Terminal.

Bash, aliases nan Bourne Again Shell, is simply a hallmark of Linux systems. However, location are different shells retired location that whitethorn connection other functionality. Here's really to instal 1 celebrated alternative, ZSH.

What is ZSH?

ZSH, besides called nan Z shell, is an extended type of nan Bourne Shell (sh), pinch caller features and support for plugins and themes. Since it's based connected nan aforesaid ammunition arsenic Bash, ZSH has galore of nan aforesaid features, and switching complete is simply a breeze.

ZSH vs. Bash: The Important Differences

ZSH has too galore features to database here, immoderate conscionable insignificant improvements to Bash, but present are immoderate of nan awesome ones:

  • Automatic cd: Just type nan sanction of nan directory
  • Recursive way description : For illustration "/u/lo/b" expands to "/usr/local/bin"
  • Automatic Syntax Highlighting: Words, record extensions, and different things visible successful nan Terminal are color-coded
  • Spelling correction and approximate completion: If you make a insignificant correction typing a directory name, ZSH will hole it for you
  • Plugin and taxable support: ZSH includes galore different plugin frameworks

Plugin and taxable support is astir apt nan coolest characteristic of ZSH and is what we'll attraction connected here. If you're connected Linux, nan bid to instal ZSH varies by nan distro, but it should beryllium a default package successful your package manager.

Install ZSH connected Ubuntu (or immoderate Debian Distribution)

To instal ZSH connected Ubuntu, aliases immoderate different Debian-based distro, unfastened up nan Terminal, past run:

sudo apt instal zsh
Install ZSH utilizing apt.

Confirm that zsh has been installed correctly by moving zsh --version successful nan console. You should spot thing for illustration this:


Now that ZSH has been downloaded and installed correctly, we request to alteration nan default ammunition from Bash to ZSH. Run:

chsh -s $(which zsh)
Changing nan ammunition to ZSH.

To beryllium judge it takes, conscionable restart your PC astatine this point. When you reopen nan Terminal, you'll beryllium fixed immoderate configuration options for ZSH. Once you've installed ZSH you tin commencement adding themes and utilizing plugins. We've covered really to do that successful nan past 2 sections of nan article.

Install ZSH connected Fedora

To instal ZSH connected Fedora, unfastened up nan Terminal, past run:

sudo dnf instal zsh
Install ZSH pinch DNF.

You'll request to corroborate you want to instal it and past hold for everything to decorativeness up. Once it is done, execute nan pursuing bid to move your ammunition to ZSH:


As soon arsenic you tally zsh you'll beryllium prompted to spell done immoderate of nan basal options zsh lets you customize.

The ZSH configuration options.

Install ZSH connected Other Linux Systems

Generally speaking, you'll want to usage your distros default package head to instal ZSH, arsenic it is included by default successful astir repositories (repos). If it is not coming for immoderate reason, you tin ever download nan root codification and instal that. Additionally, the ZSH GitHub has instructions for installing it connected nan astir celebrated Linux distros.

Install Oh My Zsh

Oh-My-Zsh is nan astir celebrated plugin model for ZSH, and it comes pinch galore built-in plugins and themes arsenic well. There are besides a mates of different plugin frameworks, including Antigen, which is simply a afloat package head for ZSH, but Oh-My-Zsh has loads of plugins built correct successful and does its occupation well.

Oh-My-Zsh has a elemental instal book you tin run:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

You'll spot a connection successful nan Terminal if everything goes correctly:


From there, you tin alteration and disable plugins by adding them to your .zshrc file, located successful your ~ directory.

The plugins conception of nan .zshrc file.

You tin get a afloat database of plugins connected nan Oh-My-Zsh repository.

How to Use ZSH Themes

There are plentifulness of themes to spell around, but powerlevel9k is by acold nan coolest. It adds a right-aligned info box, integration pinch git and bid history, unthinkable customization, and wraps it each up successful a slick interface based connected nan powerline plugin for vim. You'll want to usage iTerm connected macOS, aliases immoderate terminal pinch 24-bit color, to get nan astir retired of powerlevel9k (or immoderate ZSH theme, really).

To group up powerlevel9k (if you installed Oh-My-Zsh) conscionable clone nan repository into nan .oh-my-zsh civilization themes folder:

git clone https:

Then you request to alteration it successful .zshrc. Open nan ".zshrc" record with Vi (or usage your preferred editor), and adhd nan pursuing line.


After that, tally root .zshrc to reload nan configuration file, and you should spot nan changes applied.

If you want, you tin customize nan default punctual by defining POWERLEVEL9K_LEFT_PROMPT_ELEMENTS successful your .zshrc. Here's mine, pinch a minimal prompt:

POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(root_indicator background_jobs position load)
Set nan civilization taxable options utilizing Vim.

You tin find nan full documentation for powerlevel9k connected nan repo.

Source Tutorials