Raspberry Pi

How to Install and setup Zsh (Z shell) on Raspberry Pi

The Z Shell or zsh is the advanced form of the Bourne shell (bash) and zsh contains many unique features that are not present in the bash. For example, in the bash shell, to navigate some directory, we use the “cd” with the directory name, wherein zsh, we navigate to any directory by just using its name, moreover, the zsh also auto-corrects the minor spelling mistakes in the commands.

In this write-up, we will explore the method of installing the zsh on the Raspberry Pi operating system using the terminal.

How to install zsh on the Raspberry Pi operating system

We will install the zsh on the Raspberry Pi operating system by using the available package of zsh in the default repository of the Raspberry Pi using the apt package manager:

$ sudo apt install zsh -y

After installing the zsh, we will install the oh-my-zsh, which is the configuration tool to configure the zsh:

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

It will ask you to change the default shell to zsh, type “y” to make the zsh default shell:

The zsh shell is installed and set as a default shell on the Raspberry Pi operating system and if you answer “n” in the above question of setting zsh as the default shell, then don’t worry, because you can set zsh default later on, for that we will find out the path of the installed zsh:

$ which zsh

The path of the installed zsh is /usr/bin/zsh by using the command, we can set the zsh as default shell:

$ chsh -s /bin/zsh

Sometimes it does not allow you to proceed, in that case, we will open the configuration file of chsh:

$ sudo nano /etc/pam.d/chsh

And modify the “auth” line with:

auth sufficient pam_shells.so

After making all the settings, restart the terminal:

We are in the zsh terminal, but it is displaying notification to install the “zsh-autosuggestions” and “autojump not found”, for this, we will set them first:

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

Next we will open the “~./zshrc” using the nano editor:

~ nano ~/.zshrc

And add the following line of plugins of autosuggestions:


Next we will clone the plugins of “syntax-highlighting” using the command:

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

Again we will open the “~./zshrc” file and add plugins of syntax-highlighting by adding the line:


To use the new shell, we will list down its directories:

~ ls

Then we will navigate to the Desktop directory without the cd command:

~ Desktop


The shell is the most important part of any operating system. The zsh is the extended form of the Bourne shell, and also it comes with more advanced features than the bash shell. In this write-up, the zsh shell has been installed on Ubuntu and also set as a default shell.

About the author

Hammad Zahid

I'm an Engineering graduate and my passion for IT has brought me to Linux. Now here I'm learning and sharing my knowledge with the world.