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.

Here’s 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 a scripting language interpreter. Many useful features that you find in Bash, TCSH, and ksh were incorporated into Zsh along with many new features.

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

Although Zsh is pretty much 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 start, launch the terminal by pressing Ctrl + Alt + T on the keyboard. It’s a good practice to update and upgrade your Linux system before installing a new application on your machine. This resolves any broken or outdated packages on your system that may create an issue while installing a new application.

Now that the system packages are up-to-date, you can install Zsh. Here are the commands to install Zsh on some 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 configurations that you can always re-configure later.

Verify the Zsh Installation

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


On the terminal, you will see the version number after entering the command. If the terminal fails to show the version number, this means there was some issue with the installation.

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

 whereis zsh 

The output will display the path to Zsh on the terminal.

How to Install Oh-My-Zsh on Linux

Powerline is a powerful plugin for Vim which provides status lines and prompts for several other applications, such as Zsh, Bash, Qtile, IPython, tmux, and Awesome. It provides helpful enhancements to Zsh. To install it on Ubuntu and Debian, execute:

 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 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, execute:

 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 to make Zsh the default shell or not. To make Zsh the default shell on your system, type Yes and hit Enter on the keyboard. You can change the default shell later with chsh if you want.

Once you’ve installed Oh My Zsh on your system, you will see the following confirmation message on the terminal that verifies successful installation:

ubuntu terminal showing that ohmyzsh has been installed

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


Configure Oh My Zsh on Linux

Let’s dive into some basic configurations that you need to understand to customize Oh My Zsh the way you like.

1. Activate Plugins Using the Zsh Configuration File

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

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

 nano ~/.zshrc 
zsh-file opened with nano editor on ubuntu

In the file, locate the plugins() function. Inside the parentheses, add the name of the plugin you want to activate. For example, if you want to activate “git”, add it like this:


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

To update changes, run:

 source ~/.zshrc 

2. Set Oh My Zsh Theme

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

You can also preview these themes on your browser. Once you have 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 theme name like this:

changing theme to agnoster in z-shell configuration file

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


What if you don’t want to use all the themes but only a few specific ones? Luckily, you also have the option to keep a set of themes. Locate 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 the Automatic Updates

Oh My Zsh updates automatically every two weeks. You can disable this setting in the Zsh configuration file like this:


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


Z Shell Offers Features That You Won’t Find Anywhere Else

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

With tons of features ready to assist you, you can now start writing scripts and Bash programs more efficiently to automate tasks and save plenty of your time. Happy scripting!


Source link

Leave a Reply

%d bloggers like this: