How to install zsh shell to your linux

Afiv Dicky Efendy
3 min readFeb 6, 2021

--

What is ZSH Shell?

ZSH, also called the Z shell, is an extended version of the Bourne Shell (sh), with plenty of new features, and support for plugins and themes. Since it’s based on the same shell as Bash, ZSH has many of the same features, and switching over is a breeze.

Installation

The first thing that you must to do is update your repository:

sudo apt update

Download this font and install

Because font in this above already include with full icon

And now changed to it in your terminal (something like Preferences->Appearance->Font)

then after that is install the zsh shell:

sudo apt install zsh

Make zsh as default shell

first, you need to find out path of zsh shell:

whereis zsh

As you can see from the marked section of the screenshot above, the path of zsh shell is /usr/bin/zsh

Now set zsh as the default login shell for the user you’re logged in:

sudo usermod -s /usr/bin/zsh $(whoami)

after that then reboot your computer.

You will see configuration option on your terminal. but in my case i don’t met that configuration when i start my terminal, btw it still work perfectly.

if you meet that configuration option press number key 2 and zsh should create a new ~/.zshrc configuration file with the recommended settings.

Installing Powerline and Powerline Fonts for ZSH:

Powerline is a status line plugin for ZSH shell. Powerline font for ZSH lets the ZSH shell use different icons and symbols on the shell.

sudo apt install powerline fonts-powerline

Installing ZSH Powerlevel9k Theme:

Powerlevel9k is an awesome Powerline theme for ZSH:

sudo apt install zsh-theme-powerlevel9k

Now run the following command to enable Powerlevel9k ZSH theme:

echo "source /usr/share/powerlevel9k/powerlevel9k.zsh-theme" >> ~/.zshrc

Enable Syntax Highlighting on ZSH Shell:

ZSH has a Syntax Highlighting plugin that you can install from the official package repository:

sudo apt install zsh-syntax-highlighting

Now run the following command to enable ZSH Syntax Highlighting plugin:

echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc

ZSH and Git Integration with Oh-My-ZSH:

ZSH has an entire framework Oh-My-ZSH dedicated to work with Git version control system. To learn more about Oh-My-ZSH, please take a look at the official GitHub page of Oh-My-ZSH at https://github.com/robbyrussell/oh-my-zsh.

sudo apt install git

now after git installed, let’s install Oh-My-ZSH:

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

Then

cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
source ~/.zshrc

Installing Oh-My-ZSH changes the ~/.zshrc configuration file. It means, our Powerlevel9k theme and ZSH Syntax Highlighting plugin is disabled.

To enable Powerlevel9k theme, run the following command:

echo "source /usr/share/powerlevel9k/powerlevel9k.zsh-theme" >> ~/.zshrc

To enable ZSH Syntax Highlighting plugin, run the following command:

echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc

Changing Oh-My-ZSH Theme:

Oh-My-ZSH has many themes comes pre-installed. You can take a look at https://wiki.github.com/robbyrussell/oh-my-zsh/themes to find a theme that you like.

Now to change the theme, first you have to disable the Powerlevel9K theme from the ~/.zshrc file if you’ve enabled it.

Open the ~/.zshrc file with the following command:

sudo mousepad ~/.zshrc

Comment out the following line (Put a # mark at the beginning) to disable Powerlevel9k theme

Now set the ZSH_THEME environment variable to the name of the theme you like.

after all step above, you can customize the configuration until you like it.

This is my final result of my terminal theme after do some customize:

That’s all, thank you for reading and don’t forget to clap this article 👌

“See you in the next article…” ✋✋✋

--

--

Afiv Dicky Efendy

Linux enthusiast who wants to share his knowledge through writing on the medium