Let’s start with a simple definition: What is a shell? Shell is the software layer of an operating system that interprets commands to perform actions. For the neophyte (my wife, randomly), it takes the form of a hermetic black box with unreadable white text that scrolls. For the experienced user of an unix system, for the developer who wants to be efficient, it is the ideal tool to perform a multitude of daily tasks. I use bash since I know how to use a computer on linux, since about a pair of decades. Not only because it’s the default Command Line Interpreter installed in most distributions, but because no other interpreter I’ve ever tried has ever liked me. In my previous work, I had to use tcsh for the complicated compilation of a monstrous java program, but it never convinced me. Then, one day in 2015, a friend told me about ZSH and explained to me that I should really try. She was sure of herself by claiming that zsh was the best interpreter she could have tested. It turns out that this friend is a reference for me about the unix and BSD stuff, and she had really piqued my curiosity. I decided to test ZSH in my turn, and I was not disappointed: As soon as tried, soon adopted!

Installation and Configuration

If you are under Debian or Ubuntu (or like me on a derivative such as Mint) then you can install ZSH with apt by typing the following command:

$ sudo apt-get install zsh

To try ZSH right now, nothing more simple: just launch it with the command zsh. If this is your first launch, ZSH will offer you a wizard where you can configure a few parameters including the history or autocompletion. If you do not want to perform this configuration at this time, you can choose option (2) of the wizard, which will create a default configuration file.

The configuration of ZSH is a subject that would require the writing of a complete book. Rather than going into details not adapted to the format of this introduction, I invite you to consult the excellent ArchLinux wiki dedicated to ZSH. For a precise but rather difficult information to find, you can also check the official documentation. To set ZSH as your default shell, you will need to type the chsh command, and then specify /bin/zsh on the prompt

Completion, intelligent spelling correction, and history

The most visible improvements of ZSH compared to bash are its management of commands competion and spelling correction. Spelling correction affects typos in program names and file paths, and is very efficient to catch all small typos due to speed. The completion under ZSH is really advanced and here are some examples to illustrate its power:

Intelligent history is also a good improvement once we understand its operation and we have become used to it. The principle is to restrict the history, accessible with the UP and DOWN arrows of the keyboard, to the commands containing the text already entered at the prompt. This allows you to go back very quickly on a particular command, entering only the start of it, then typing the up arrow.

Going further with Oh-My-ZSH

ZSH is powerful, and its functions of autocompletion and history save us a lot of time on a daily basis. We could be satisfied with this situation and leave it at that, but no! We can go even further with cool features with Oh-My-Zsh, a framework for Zsh which provides many plug-ins (full support of Git, PHP, Python, PostgreSQL …), as well as many themes for your command prompt.. Its installation is very simple and is done with the following command:

curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh

Themes

The default theme is very minimalist, and you will find the complete list of themes available on Github. You will inevitably find one that you like. To change its theme, simply edit .zshrc and modify the line:

THEME = "robbyrussell"

Simply replace robbyrussel with the name of the desired theme. For my part, I use the theme agnoster.

Empowered Shell with ZSH

Plugins

There are a very large number of plugins for Oh-My-Zsh, which support autocompletion or help for some particular programs, or offer new features. To activate them, nothing more simple, just list them in the option plugins=() of your .zshrc file. The list of plugins and their descriptions is available, as for the themes, on the Github wiki of Oh-My-Zsh. Here are the plugins that I think are essential, and that I use:

Conclusion

ZSH is really a powerful and user-friendly interpreter, and in conjunction with Oh-My-ZSH, it definitely becomes the most complete and customizable shell you can test. I strongly encourage you to try it, and to tame it gradually to make it as much as possible adapted to your needs and your habits. If you already use ZSH, do not hesitate to share your tips in the comments!