In this small post I just will explain you how to install Zsh shell interpreter on a Ubuntu host. If you read this post, you probably know the advantages and disadvantages of it. In this post, I will use terminator software and not the classical “terminal” application available of Ubuntu by default. If you don’t have terminator, just install like like this
sudo apt-get install terminator --yes
To install zsh, simply run this command
sudo apt-get install zsh
Close your terminal and restart it again. Normally, you should have the new shell prompt. If it is not the case, you must configure it to be your default shell interpreter.
Note: With Ubuntu 14.04 LTS, when you close the terminal and restart it, Zsh is directly in use. With Ubuntu 15.04 (Vivid), it is not the case and Zsh is not under /bin but under /usr/bin.
To know where Zsh is installed, simply use this command:
which zsh /bin/zsh
Now you can use this command to change the default shell. (in my case I use Ubuntu 14.04)
chsh Password: Changing the login shell for fl0at_0xff Enter the new value, or press ENTER for the default Login Shell [/bin/bash]: /bin/zsh
You will be prompted for the current user’s password. This command change only the default shell interpreter for the current user. You can see that the current shell is set to /bin/bash so just write /bin/zsh and press Enter.
You can close the terminal and restart it and normally it will start a new zsh session.
I will just little speak about this main configuration files.
This file contains a configuration which is applied to all users.
This file is the configuration dedicated to a specific user. If you modify a configuration file, it is important to run the command
sudo source /etc/zsh/zshrc sudo source ~/.zshrc
to take in account the new parameters.
I will not explain how to configure this interpreter but you can find all documentation needed on the following page.
Installation of “Oh-My-Zsh”
Oh-My-Zsh is a github project framwork for managing your Zsh configuration. It includes 180+ optional plugins and more than 120 themes to spice up your journey. For complete information, please visit the official Git home page : https://github.com/robbyrussell/oh-my-zsh
To install it, just run this command
wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh
Selecting a theme
You can have some screenshot of many themes at this URL : https://github.com/robbyrussell/oh-my-zsh/wiki/themes. All themes can be found in the themes/ directory in the oh-my-zsh distribution. The list of all the themes can be checked here : https://github.com/robbyrussell/oh-my-zsh/tree/master/themes/. Once you have selected a theme, you must configure Zsh to use it (always in the same configuration files)
Agnoster is probably the most famous and sexy theme. Once done, just close terminal and try to restart it. With Ubuntu based distribution, you will have a font problem. To fix this problem, it is necessary to install the powerline fonts.
Installing the powerline fonts
This installation is very simple. Just clone the Git repository and run the install.sh
git clone https://github.com/powerline/fonts.git cd fonts sudo ./install.sh
After the installation, it is necessary to configure the current terminal to use these fonts. For example with terminator, right click in the terminal, Preferences, Profile tab, and uncheck the option “Use the system fixed width font” and choose a Powerline font like “Meslo LG S for Powerline“.
Install the Zsh Syntax Highlighting plugin
This cool plugin allows the shell to colorize basic command.
git clone git://github.com/zsh-users/zsh-syntax-highlighting.git mv zsh-syntax-highlighting ~/.oh-my-zsh/plugins
Just clone the plugin repository and move the cloned folder into plugins directory of .oh-my-zsh.
if you want to enable specific plugins (like the previously installed one for example), you will need to edit the ~/.zshrc (user configuration) or /etc/zsh/zshrc (global configuration) and edit a line which looks like:
Just source the modified configurations files.
Note: All plugins can be found in the file ~/.oh-my-zsh/plugins/.
That all ! You have a awesome new terminal !
Thank to Vincenzo for his help ! 🙂