15.4 C
New York
Friday, September 29, 2023
HomeLinuxHow to Install and Configure ZSH on Linux Distributions

How to Install and Configure ZSH on Linux Distributions

Customizing and replacing the Linux terminal bash doesn’t only make it look different from the traditional Linux shell look; it also makes your bash shell more powerful and efficient. On Linux distribution, you can install the ZSH and replace the conventional bash shell. You might get confused with the ZSH and the Tilix terminal emulator; let me clear, the Tilix is just an emulator, where the ZSH is a powerful bash shell for Linux. As the ZSH is more powerful than the current default bash shell, I think Linux might consider the ZSH to set it as the default bash shell. The ZSH is helpful for multitasking and bash-scripting. To use the Z-shell on your Linux system, you don’t need to know any bash scripting knowledge.

ZSH on Linux

The ZSH tool is more than just a terminal shell; it can learn from your previous commands that can make you more powerful and intelligent. If you write any wrong syntax in the command, it can automatically correct your syntax errors by analyzing your command style and keywords from your previous inputs.

The ZSH has a considerable plugin and theme store. There are over two hundred plugins for different packages and tools. You can install plugins to run the ZSH bash on those packages. Moreover, the ZSH supports case sensitivity, auto-correcting in bash-commands.

Installing the ZSH tool on Linux is not a tough job. As the ZSH tool is available on Linux’s official repository, you can install it on your Linux system by using the default is package manager commands on your Linux distribution. In this post, we will see how you can install the ZSH (Oh My Zsh) on your Linux distributions.

Step 1: Install ZSH on Linux Distributions

Here, we will see a few methods of installing the ZSH tool on various Linux distributions. Ubuntu, Linux Mint, and other Debian users can install the ZSH tool on their Linux system by using the aptitude package manager. Red Hat, Fedora, and CentOS users can use the default YUM or the DNF command on their system to get the ZSH tool. Arch and Arch-based Linux users can use the Pacman command to install the ZSH on their system.

1. Install the ZSH on Debian/Ubuntu

Run the following apt commands given below to update your system repository and install the Z-shell on your Ubuntu and other Debian Linux system. It will initialize the installation of the zsh-common package on your system. Now, finish the process by typing Y and hit the Enter button.

sudo apt update
sudo apt install zsh

Linux apt install zsh

Once the installation is finished, you can now check the version of Z-shell to ensure that it is installed correctly.

zsh --version

z shell version

2. Install ZSH on Fedora/Red Hat Linux

If you are a Fedora Linux user, you can run the following DNF command given below to install the ZSH tool on your system. It will initialize the process the installing the Z-shell on your system and ask for your permission. You can simply type y and hit the Enter button to finish the process.

sudo dnf install zsh

zsh on Fedora Linux install

If you are using an older version of CentOS, you can run the following command-lines on your terminal shell to download and install the ZSH on your CentOS Linux.

wget https://download.opensuse.org/repositories/shells/CentOS_5/shells.repo
sudo yum update && sudo yum -y install zsh

3. Install ZSH on SuSE Linux

If you are a SuSE or openSuSE Linux user, you can run the following zypper commands given below to upgrade your system repository and install the ZSH tool on your SuSE Linux system.

sudo zypper upgrade
sudo zypper install zsh

You can also manually download and install the .ymp package of the Z-shell on your SuSE Linux system. You can visit this page to find the appropriate Z-shell package for your SuSE Linux.

download oh my z-shell for suse Linux

4. Install ZSH on Arch Linux

We will use the Pacman package manager command to install the ZSH tool on our Arch and Arch-based Linux system. Here, I am using the Manjaro KDE to demonstrate the method of installing the Z-shell on Arch Linux. Run the following Pacman command on your terminal shell to install the Z-shell on your Arch Linux.

sudo pacman -Syu zsh

zsh on arch Linux pacman

Step 2: Configure the ZSH Tool

Till now, we have seen the method of installing Z-shell on our Linux system. It’s time to configure the ZSH on Linux. Here, we will see how to configure the theme, plugins, and other settings of the Z-shell.

Here, the configuration part is divided into two parts; first, you have to download and install the theme for ZSH; later, you can change the values of the Z-shell. As the configuration and setting part is the same for all Linux distributions, the in-depth explanation of the ZSH theme and settings are explained below in the Debian section; follow that part for better understanding.

1. Configure ZSH on Debian System

After installing the Z-shell on Debian Linux, you need to run the following aptitude package manager commands given below to install the Git-core fonts and the Robbyrussell theme for the Z-shell. You can choose other themes as well, but the default theme is set as Robbyrussell. For your information, Robby Russell is the creator of the Oh My ZSH.

sudo apt install git-core curl fonts-powerline
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Zsh on Ubuntu apt install

You can now run the following command on your terminal shell to select the theme, path, and other settings. Here, I am using the Nano tool to edit the script. You can use Gedit, Vim, or any other script editor as well.

sudo nano ~/.zshrc

To replace the theme, you need to know the name of the theme you want to use. You can find the themes for ZSH here. Then, replace the value of ZSH_THEME=Robbyrussell with your desired theme name. Then save and exit the script.

zsh nano configure on linux

You can also set the values of case sensitivity, hyphen sensitivity, auto-update settings, and other settings by uncommenting syntaxes on the script. You can also adjust the preferences by changing the values from true to false. Nevertheless, you have to uncomment the syntaxes anyway to change the default settings. Finally, save and exit the file.

z shell configurations

Here, we want to install and activate the highlighting plugging on the ZSH; we need to run the following command given below to clone the highlighting plugin from Git. Make sure that Git is installed inside your system.

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Then, we have to run the ZSH configuration command to load the settings. Then, we can change, add, or remove the values of ZSH plugins on the configuration script. Find the following syntax and put the name of your plugin. Then, save and exit the file.


You can find the standard plugins inside the ZSH/plugins/ directory. Here, you can find a lot of plugins for the Z-shell.

2. Configure ZSH on Red Hat Linux

To configure the Z-shell on Fedora and Red Hat, and other Red Hat-based Linux system, run the following package manager commands given below to download the cURL on your system. The following command will install the Robbyrussell theme for the Z-shell on your system.

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

You can now run the following commands to edit the Z-shell configurations.

source ~/.zshrc
sudo nano $HOME/.zshrc

Nano editor theme name

3. Configure ZSH on Arch Linux

If you are an Arch and Arch-based Linux user, run the following commands given below to install the master theme on the ZSH tool. As we are using the cURL command to install the theme, make sure that the cURL is installed inside your Arch Linux.

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

download oh my zshell

After the theme’s installation is done, you can now configure the ZSH setting script on Arch Linux. Follow the Debian/Ubuntu configuration part given above to get a detailed guideline to configure the ZSH settings.

Extra Tip: Make ZSH As the Default Shell

As the ZSH is not the default bash shell on your Linux system, every time you press the Ctrl+Alt+T, it will open the traditional terminal shell. To make the ZSH your default shell, you need to run the following command-line on your terminal shell. Don’t forget to replace the user name with yours.

sudo chsh -s /bin/zsh ubuntupit

Remove ZSH from Linux

Here, we will see how you can remove the ZSH on your Linux system. We will see different methods and command-lines to remove the Z-shell from our system. Run the following commands according to your Linux distribution to remove the Z-shell.

Remove ZSH on Fedora and Red Hat Linux.

sudo dnf remove zsh
sudo yum remove zsh

Remove ZSH on SuSE Linux.

sudo zypper remove zsh
sudo zypper rm zsh

You can also use the YaST package manager tool to remove the Z-shell on your SuSE and openSUSE Linux.

Remove ZSH on Arch Linux.

sudo pacman -Rs zsh

Remove ZSH on Ubuntu/Debian Linux.

sudo apt-get --purge remove zsh

How to remove oh my z-shell

Ending Words

The ZSH is one of the best bash tools for Linux power users. As nowadays, the bash is being more limiting; on the other hand, the ZSH tool is an advanced and best alternative tool to replace the bash shell on Linux. You can consider the ZSH tool as one of the list’s must-have tools for Linux power users.

In the entire post, I have described the benefits of having the ZSH tool and the method of installing it on your Linux distribution. If you find this post useful and handy, please share it with your friends and the Linux community. You can also write down your opinions regarding this post in the comment section.

Mehedi Hasan
Mehedi Hasan
Mehedi Hasan is a passionate enthusiast for technology. He admires all things tech and loves to help others understand the fundamentals of Linux, servers, networking, and computer security in an understandable way without overwhelming beginners. His articles are carefully crafted with this goal in mind - making complex topics more accessible.

You May Like It!

Trending Now