The Z shell is one of the most powerful shells ever developed, and it’s also one of the fastest. It offers features you won’t find anywhere else, such as built-in spell checking, syntax highlighting for code, and much more. You can even configure the command prompt to display useful information about your system status without having to type anything.

Some features you will find useful are:

  • Spelling correction
  • Tab completion for your files and commands and much more.

Check the resources for a full list of Z shell’s features.


  • A fresh install of Ubuntu 20.04 on the server.
  • A non-root with root privileges is configured on the server.

Updating the System

First of all, we need to update the system to make sure we have the latest software and security patches.

sudo apt-get update && sudo apt-get dist-upgrade -y
sudo apt-get install build-essential curl file git

Installing ZSH on Ubuntu

Now that your system is updated, you are all set to install ZSH with the apt command.

sudo apt install zsh

During the installation process, you will be asked if you would like to continue with the Z shell installation. Press Y and hit Enter to confirm your selection.

Install ZSH on Ubuntu

The command above will take some time to install. The installation process will go over the basic configuration of ZSH. You can always change these settings later, but for now, we don’t need to configure it.

Now that ZSH is installed, you can check the version number with the zsh –version command. This command will print out the version number of ZSH on the server.

The Version command is a useful way of checking which version you’re currently using but it won’t give any information if something isn’t installed or just partly installed. Your version number may be different from the one in this picture. That’s normal.

zsh --version

Check ZSH version

If you do not see the ZSH version number after executing the zsh –version command, it means that something went wrong during installation. Check your path again or try to reinstall the ZSH using this command:

sudo apt install zsh && sudo dpkg-reconfigure dash && sudo reboot

The default directory where your ZSH is installed is /usr/bin. You can confirm this by printing the location of zsh using the which command:Advertisement

whereis szh

The whereis command prints out exactly what its name suggests, the path to a terminal program or script. In our case, it is the exact location of ZSH.

Installing Oh-My-Zsh Plugin

On-My-Zsh plugin provides some amazing shell enhancements to ZSH.

You can install the plugin by typing this command in your terminal:

sudo apt install git-core curl fonts-powerline
sh -c "$(curl -fsSL"

This command will set up Zsh as the default set shell for all users. So you don’t need to log out or reboot the server. Type Y and hit Enter to continue. The installation will complete within a few seconds.

ZSH as default shell

Open your browser and go to GitHub to get a list of all available plugins.

When you’ve finished browsing the available plugins and found the one you want to use, add its name to the plugin() function in the /.zshrc file to activate it. For example, to activate the python plugin, simply add the following line to the ~/.zshrc file.

plugins=(python pip)

After changing the theme, use Ctrl-O to save and Ctrl-X to exit. Then reload Oh My ZSH plugin by typing:

source ~/.zshrc

Configuring the Oh-My-Zsh Theme

The default directory for Oh-My-Zsh Theme is ~/.oh-my-zsh/themes/. You can find all the themes there.

To view the list of the available themes, open your browser and navigate to:

It’s not wise to use rainbow colors or other hard-to-read colors. Also, the themes with white and light words on a black background are not recommended for users whose vision is compromised or who use headless servers without a monitor.

You can preview the theme in your browser. Once you found a theme that you like, open the ~/.zshrc file with any code editor.

sudo nano ~/.zshrc

You can see in the screenshot above, that the default theme is robbyrussel.

Configure ZSH

You can change the theme by replacing this text in the line ZSH_THEME= with the one you like. For example, if you want to set the agnoster theme as your ZSH style, you need to replace robbyrussel with agnoster.


Install Agnoster Theme

If you want to alternate between multiple themes on a regular basis, change the ZSH_THEME= parameter to random.

sudo nano ~/.zshrc

If you want to alternate between multiple themes on a regular basis with a specific set of themes, define the ZSH_THEME_RANDOM_CANDIDATES parameter with the themes you choose to use. For example, we will use agnoster, grml and robbyrussel at random.

ZSH_THEME_RANDOM_CANDIDATES=("agnoster" "grml" "robbyrussell")

Multiple Themes in ZSH

After changing the theme, use Ctrl-O to save and Ctrl-X to exit. Then reload Oh My ZSH plugin by typing:

source ~/.zshrc

Configuring OH-MY-ZSH Automatic Update

OH-MY-ZSH updates automatically once in two weeks. To disable it, uncomment the DISABLE_AUTO_UPDATE and set parameter DISABLE_AUTO_UPDATE=“true” in the ~/.zshrc file.

sudo nano ~/.zshrc

OH-MY-ZSH Automatic Update

You also can set the number of days for the update check. For example, if you want to skip Auto-Update every day, set parameter UPDATE_ZSH_DAYS=1


Type Ctrl-O followed by Enter to save and Ctrl-X to exit. Then reload Oh My ZSH plugin by typing:

source ~/.zshrc

You can also run the update manually by typing:

omz update

omz update command

Finally, restart your system to apply the changes.

sudo reboot now

That’s it! You have successfully installed and configured OH-MY-ZSH on Ubuntu 20.04.

Uninstalling OH-MY-ZSH

For any reason, if you wish to uninstall OH-MY-ZSH and their plugins and themes from Ubuntu 20.04, simply remove the ‘oh-my-zsh’ package by typing this command in your terminal:

sudo uninstall oh_my_zsh

This command will delete all of the files and folders that came with oh-my-zsh and return the server to the state before you installed it.


In this tutorial, we have learned how to configure and use the Oh-My-ZSH on Ubuntu. The steps in this guide should work equally well on other Linux systems. If you have any questions or thoughts to share, feel free to leave a comment below.

How to Install Z-Shell (ZSH) and Oh-My-Zsh on Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *