Install zsh

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.echo $SHELL In this case, the default shell is bash. /bin/bash

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”: sudo apt-get install zsh Change the default shell as followed:chsh -s /bin/zsh -user To set it to default for just one user, substitute user with your username. If you want to set if for all users run the command without -user. The changes take place after a new log in. After opening the Terminal a few options will be provided. We recommend to choose (0), an empty ~/.zshrc file will be created.
Run echo $SHELLagain, to check if the default shell is now zsh.

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:sudo apt-get install git -y Oh-my-zsh is installed by running the following commands with either wget or curl.

via curl:
sh -c “$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)”

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

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).
sudo apt-get install python-pip -y sudo -H pip install powerline-status

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:
xset -qNow move the downloaded file with the extension .otf into the fonts path e.g. /usr/share/fonts/ all subdirectories can be ignored. Use sudo to do so. For our path we use:sudo mv Inconsolata\ for\ Powerline.otf /usr/share/fonts/Replace “/usr/share/fonts/ with your fonts path, if different from ours. Update cache by running fc-cache /usr/share/fonts/
Open Terminal. Right click, choose Profiles/Profile Preferences. Choose custom fonts and search for Inconsolata for Powerline.

Leave a Reply

Your email address will not be published. Required fields are marked *

Just another Linux site