The z shell or zsh is a powerful alternative to Ubuntu’s standard shell Bash (Bourne again Shell). It adds a few features that makes working in the Terminal on a daily basis more comfortable. It simplifies navigation and, in combination with oh-my-zsh, makes working with git way more convenient.
This brief tutorial shows how to install zsh , oh-my-zsh and how to configure it.
Step 1: Check current Shell
First of all, you should check your current shell. Assuming you are running Ubuntu out of the box the following command shows your current default shell.
Step 2: Download and install zsh
Zsh is already included in the official Ubuntu package repository, all you need to do is to run the following line in the Terminal and confirm with “y”:
Step 3: Install oh-my-zsh
To use the full potential of zsh a good configuration is needed. Therefore we recommend oh-my-zsh. It provides a lot of plugins, themes and configurations.
Before installing oh-my-zsh you need to install git. Run:
Now that the oh-my-zsh install is complete, you can choose from a big variety of themes. Themes can be changed in the ~/.zshrc file. In Linux all files starting with a dot “.” are hidden files. These files can be displayed in the file manager of your choice e.g. nautilus, thunar file manager etc. by pressing “ctrl + h”. The .zshrc file is located in your home directory.
To change the theme go to the ZSH_THEME=”robbyrussell” line and replace “robbyrussel” with the name of the theme of your choice.
Some themes like “agnoster” need additional packages. Powerline is a plugin to show additional information in a clean way. The requirement to install Powerline is pip (pip installs python).
Step 4: Install patched fonts
If you chose agnoster, and the theme looks f*ed up, do the following. Go to www.github.com/powerline/fonts and choose a font e.g “Inconsolata” and download it.
Move the patch font to a valid X font path. Find the right path by:
Open Terminal. Right click, choose Profiles/Profile Preferences. Choose custom fonts and search for Inconsolata for Powerline.