This tutorial will guide you through steps to Install Zsh on Linux and Configure it to suite your needs.

Definition of shell from Wikipedia:
A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems. Users direct the operation of the computer by entering commands as text for a command line interpreter to execute or by creating text scripts of one or more such commands.
Most fresh installation of Linux comes pre-loaded with Bash shell. Personally i like zsh, and it’s my favorite shell that i use all the time.
Why Zsh?
Zsh does a bunch of other useful things that bash alone won’t accomplish.
Apart from being a powerful scripting language, Zsh is a shell designed for interactive use.It incorporates into it many useful features of Bash, ksh, and tcsh.Othe additional features provided by zsh are:

  1. Auto Completions are case insensitive much faster than bash.
  2. All sorts of bells and whistles made possible by community driven framework like oh-my-zsh.
  3. Support multi-line editing
  4. Recursive file globbing
  5. Highly compatible with ksh.
  6. Zsh has huge collection of better themes.
  7. Simple configuration style
  8. Output redirection to multiple destinations

And many more, do some googling to learn more. Here you’ll Install Zsh on Linux.

 Install Zsh on Linux

How to install Zsh on Arch Linux and Manjaro

sudo pacman -S zsh

How to install Zsh on Gentoo

emerge --ask zsh

How to install Zsh on Ubuntu and Debian based systems.

sudo apt-get install zsh

How to install Zsh on Fedora 23

sudo dnf install zsh

How to install Zsh on Fedora 22 and below

yum install zsh

How to install Zsh on CentOS and RHEL

yum install zsh

Check and Change shell to Zsh

Confirm it’s installed and see list of installed shells. After you successfully Install Zsh on Linux, you should see version displayed.

zsh --version 
chsh -l

After you’ve installed it, we need to make it our default shell and customize it to get extra eye-candy.We’ll change shell for both root and standard user account.
Non-root account,

usermod username -s /usr/bin/zsh

or

chsh -s /usr/bin/zsh username

Root account:

su -

Then,

chsh /usr/bin/zsh
Install Zsh on Linux

 

Install Oh My Zsh

Easiest way to customize zsh is to install Oh My Zsh to set zsh theme. Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.It comes with load of plugins and themes to take advantage of. Install it as below.
Prerequisites:

  1. Wget
  2. curl
  3. git

Make sure you have all above prerequisites installed on your system.

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

Once installed, you’ll get a bundle of themes that comes with it, located at ~/.oh-my-zsh/themes/

ls -l ~/.oh-my-zsh/themes/

Install Zsh on Linux

You can also take a look in the plugins directory to see all plugins available.

ls -lh ~/.oh-my-zsh/plugins

Install Zsh on Linux

Install Oh My Zsh themes for Zsh

We’ll install my favorite theme to ~/.oh-my-zsh/themes/ and configure .zshrc to use it.

cd ~/.oh-my-zsh/themes/
git clone https://github.com/oskarkrawczyk/honukai-iterm-zsh.git
cp honukai-iterm-zsh/honukai.zsh-theme ~/.oh-my-zsh/themes/

Modify theme variable name to ZSH_THEME=”honukai” in ~/.zshrc

nano ~/.zshrc

See screenshot below,

Install Zsh on Linux

Save changes and exit. Type CTRL+X, Then Y.
Source ~/.zshrc file

source ~/.zshrc

Configure Help command.

nano ~/.zshrc

Add the following lines to the end.

autoload -U run-help
autoload run-help-git
autoload run-help-svn
autoload run-help-svk
alias help=run-help

Source it and you’re good to go.

source ~/.zshrc

Fish-like syntax highlighting (Optional)

cd ~/.oh-my-zsh/plugins 
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git 
nano ~/.zshrc

Add below line at the end,

source ~/.oh-my-zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

Then source zshrc file

source ~/.zshrc

Persistent rehash: This allow compinit to automatically find new executables in the $PATH.

nano ~/.zshrc

Add line:

zstyle ':completion:*' rehash true

Install Zsh on Linux

Save and exit, the source it.

source ~/.zshrc

Configure additional zsh-completions, applicable to all Linux systems.
I will assume you already installed oh-my-zsh, if not refer to it above.

git clone https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions

Then enable it in your .zshrc

nano ~/.zshrc

Add

plugins+=(zsh-completions)
autoload -U compinit && compinit

Install Zsh on Linux

zsh tab-completion system

To enable the famous zsh tab-completion system, you need to add above commands ( autoload -U compinit && compinit).
If you are running Arch Linux, you can install it using Pacman package manager. This has an advantage of getting updates for it automatically.

pacman -S zsh-completions

Installing  zsh-completions on Gentoo

emerge --ask zsh-completions

When you use pacman and emerge, it will enable it automatically on zshrc file.
To unistall oh-my-zsh type

rm -rf ~/.oh-my-zsh

Conclusion

We’ve covered how to Install Zsh on Linux and configuring Zsh environment on your system. Zsh is the most customizable shell i have ever used. It’s easy to install and customize with more than 100 themes. There are plenty of plugins to extend its functionality with frameworks like oh-my-zsh. Zsh is worth your time and i think you should give it a try.