Overview

This post is intended to act as guide and demonstrate the steps how to install ZSH on Linux.

The following guide will demonstrate how to install ZSH in Linux(aka zshell) and also showcase the steps on how to set zsh as a default shell on login.

ZSH is available by default in many repositories of Linux package managers, so the install process is straightforward

Install ZSH on Ubuntu/Debian/Mint/Pop OS

In order to install ZSH on Ubuntu or Debian or on any Debian/Ubuntu based distro, the ZSH can be installed via the “apt” package and to install it, simply run the following command:

sudo apt install zsh

Install ZSH on Fedora

ZSH is also available in dnf repositories so in order to install it, simply execute the following command:

sudo dnf install zsh

how to install zsh on linux

Set ZSH as a default Shell

Installing the ZSH is only the half of the process and it won’t be usable until we switch the shell and set ZSH as a default Shell.

Set ZSH as a default Shell on Ubuntu/Debian

To change a default shell to zsh on Ubuntu/Debian and other debian/based distros, we need to use the “chsh” tool in the terminal. To do so, execute the following command:

chsh

how to install zsh on linux

The tool will ask for the sudo password. After you provide it with the password, the tool may not be able to detect the new installed shell(the ZSH), which was in this case, and it will ask you to provide it with the path to the new shell. The ZSH path by default is located at - “/bin/zsh”.

After the change, reboot your laptop/desktop to apply the change.

Set ZSH as a default Shell on Fedora

One small note - by default Fedora doesn’t have the “chsh” tool preinstalled. Instead, we can use the “lchsh” tool. If you want to use the “chsh” tool, then it is required to install on Fedora the “util-linux-use” package which comes with the “chsh” tool. After that, the steps are the same as are for Debia/Ubuntu and others.

Now to demonstrate the usage of the “lchsh” tool. To change the shell with it, run the following command:

sudo lchsh $USER

The tool should automatically detect that you’ve installed another shell in your system and if it does, it will prompt you asking if the ZSH is the new shell you want to set as a default shell. Sample picture bellow:

how to install zsh on linux

If that’s the case, there is no need to add anything, just hit “Enter”.

If by any chance the tool does not detect the new shell, the in the prompt where it asks you to specify the new shell, add the path to the ZSH, which is by default located at - “/bin/zsh”.

The new change will apply after you restart your laptop/desktop.

ZSH configuration(first login)

On the new login, when you run the terminal with the ZSH shell for the first, you’ll be greeted with the startup message for the ZSH configuration and its configuration files.

how to install zsh on linux

The ZSH will offer multiple choices - you can do nothing in order to configure everything manually, or you can just create an empty “.zshrc” file and rest of the configuration leave on default or go with the option “Continue to the main menu” which is a small setup wizard and configure options like shell history, autosuggestions(autocomplete) and key mapping and start with that setup preconfigured(sample pictures bellow).

how to install zsh on linux

Summary

This guide has covered the steps on how to install ZSH on Linux - to be precise, how to install ZSH on various Linux distro’s such Debian, Ubuntu, Fedora and so on. We also demonstrated how to set ZSH as a default shell once you’ve logged in.

Thank you very much for your time…