How to Install Z Shell (Zsh) and Oh My Zsh on Linux

Z shell is an efficient, powerful and interactive Unix shell. It’s easy to install, configure, use, and learn on any Linux platform, including Ubuntu, Fedora, Arch Linux, and more.

This is how you can install Z shell and Oh My Zsh on your Linux machine.

What is Z Shell and Oh My Zsh?

Z shell, or simply Zsh, is an interactive login shell and scripting language interpreter. Many useful features that you find in Bash, TCSH, and ksh have been incorporated into Zsh along with many new features.

Oh My Zsh is an amazing community driven open source framework that helps you manage Zsh settings. It comes packed with so many useful features, helpers, plugins, themes, and other utilities that offer users the best shell experience out there.

Although Zsh is quite similar to Bash, the advantage of using Zsh lies in the fact that it is much more customizable than Bash.

How to install Zsh on Linux

To get started, launch the terminal by pressing Ctrl+Alt+T on the keyboard It is a good practice to update and update your Linux system before installing a new application on your machine. This resolves any broken or outdated packages on your system that might create a problem when installing a new app.

Now that the system packages are up to date, you can install Zsh. Here are the commands to install Zsh on some of the major Linux distributions:

For Ubuntu, run:

sudo apt install zsh

To install Zsh on Fedora, run:

sudo dnf install zsh

On Arch Linux, run:

sudo pacman -S zsh

The installation process will also cover basic settings that you can always reconfigure later.

Verify Zsh Installation

One way to verify the installation is to check the version of Zsh you just installed. Run the following command to check the version:

zsh 

In the terminal, you will see the version number after entering the command. If the terminal does not show the version number, it means that there was a problem with the installation.

By default, Zsh is installed on the /usr/bin directory. To confirm the location where you installed Zsh, run:

whereis zsh

The output will show the path to Zsh in the terminal.

How to Install Oh-My-Zsh on Linux

Powerline is a powerful plugin for Vim that provides status lines and prompts for various other applications including Zsh, Bash, Qtile, IPython, tmux, and Awesome. It provides useful enhancements to Zsh. To install it on Ubuntu and Debian, run:

sudo apt install git-core curl fonts-powerline

On Fedora:

sudo dnf install powerline-fonts

To install Powerline fonts on Arch Linux:

sudo pacman -S powerline-fonts

Step 1: Install Oh My Zsh on Linux

Once the Powerline fonts are installed, it’s time to finally install the oh-my-zsh package. There are two ways to install it: using curl and wget.

To install Oh My Zsh using curl, run:

sh -c "$(curl -fsSL 

Instead, if you want to use wget to install Oh My Zsh, use this:

wget --no-check-certificate http:

During the installation process, the installer will ask you if you want Zsh to be the default shell or not. To make Zsh the default shell on your system, type Yes and hit Get into on the keyboard. You can change the default shell later with chsh if you want.

Once you have installed Oh My Zsh on your system, you will see the following confirmation message in the terminal verifying that the installation was successful:

ubuntu terminal showing ohmyzsh has been installed
Install Oh My Zsh on Linux

To uninstall oh-my-zsh from your system, run:

uninstall_oh_my_zsh

Configuring Oh My Zsh on Linux

Let’s go through some basic settings you need to understand in order to customize Oh My Zsh the way you want.

1. Activate plugins using Zsh configuration file

To see what plugins are available, open the Oh My Zsh Plugins page on GitHub.

Here you will find a list of all plugins you can use in Oh My Zsh. Once you’ve decided which plugin you want to use, open the Zsh configuration file using nano:

nano ~/.zshrc
open zsh file with nano editor on ubuntu
Activate plugins using Zsh configuration file

In the file, find the accessories () function. Inside the parentheses, add the name of the plugin you want to activate. For example, if you want to enable “git”, add it like so:

plugins=(git)

Save and exit the file by pressing Ctrl+X after Y on the keyboard

To update the changes, run:

source ~/.zshrc

2. Set Oh My Zsh Theme

You will find all the songs of Oh My Zsh in the ~/.oh-my-zsh/themes directory. To see all available themes, go to the Oh My Zsh topic page on GitHub.

You can also preview these themes in your browser. Once you’ve decided on the theme, open the Zsh configuration file like this:

sudo nano ~/.zshrc

Go to the line that says ZSH_THEME=””. Here, enter the theme you want to keep. For example, if you want to change the theme to “agnoster”, enter the name of the theme like this:

ZSH_THEME="agnoster"
changing the theme to agnoster in the z-shell configuration file
Set Oh My Zsh Theme

You can also set this option to “random” if you want to switch between different themes regularly.

ZSH_THEME="random"

What if you don’t want to use all themes, but only specific ones? Fortunately, you also have the option of keeping a set of themes. Find the line that says ZSH_THEME_RANDOM_CANDIDATES=() and enter the theme names like this:

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

Reload the file for the changes to take effect:

source ~/.zshrc

3. Configure Automatic Updates

Oh My Zsh is automatically updated every two weeks. You can disable this setting in the Zsh config file like this:

DISABLE_AUTO_UPDATE="true"

You can also set the number of days you want Zsh to check for updates like this:

UPDATE_ZSH_DAYS=1

Z Shell offers features you won’t find anywhere else

Z shell comes with so many features that are hard to find in other shells. It comes with a built-in spell checker and allows you to highlight code. It comes with many amazing themes that you can apply to the shell. You can also configure the shell to display important system information.

With tons of features ready to help you, you can now start writing Bash scripts and programs more efficiently to automate tasks and save a lot of time. Happy script!

Leave a Reply

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