Boost your CLI environment

Most of modern softwares have a handy graphical user interface that allows executing different operations by few actions. We are talking not only about user interfaces for social networks, messengers, email clients etc. You can even create an entire website or a standalone application by few clicks and labels using different automated software with a good UI toolkit. That’s really great because it involves more and more people into attempts to create something new and special. However, what about people who stand behind this scene – developers, who create “software for creating a software”?

You need to start on a low level to have something on a high level. The most flexible system configurations and automations begin from the most basic interfaces that usually require engineering skills. One of the basic tools, commonly used for different approaches, is a command line interface (CLI) that allows to interact with a system by entering different commands. Despite the abundance of modern software, many developers use CLI for their “daily needs”. And that really makes sense, because in that way – “by having nothing you can do everything”(c). If you are one of these developers, you might be interested how to enhance your CLI. Surely, if you have not done it yet.

As you may also know, bash – is the most popular UNIX shell and it’s really awesome. However, if you are using CLI every day, after some time you will start looking for a way to automate some simple operations or make the interaction with the system more handy. Fortunately, we have different alternatives to Bash that worth to be tried. One of them is called “Fish” (friendly interactive shell – it is really user friendly and “exotic” interactive shell. It has great features such as autosuggestions, history search, easy configuration etc. Unfortunately, it’s not fully compliant with POSIX standards and you may face with different difficulties such as compatibility with other command line tools.

The next one is ZSH (Z shell). Here you can find almost everything you need. One of the roadblocks that appear on the way of users who start working with ZSH is its configuration. You need to spend few nights digging into the configurations in order to make this shell your “friend”. There is a way to speed up the configuration process: you can take a predefined configuration created by someone else and tweak it for your needs. One of the most popular configurations called “OhMyZsh”. You can find it on GitHub – This configuration has different utilities for working with GIT repositories, Ruby tools etc. Also, it’s really easy to configure – everything you need is to install ZSH itself (the installation process depends on the operating system). Then, use the following command to check if you already have ZSH installed:

zsh --version

You should get a version number if the ZSH shell is installed. Please note, you need to have at least v4.3.9 in order to use OhMyZsh. After this, download the configuration installer using Curl (or Wget). The OhMyZsh configuration will be installed automatically:

curl -L | sh

On the next step, you need to switch your interactive shell from the previous one to ZSH. There is a command for this purpose in the Unix systems (you will be prompted to enter the password upon the operation execution):

chsh -s [zsh_binary_path]

where [zsh_binary_path] is an absolute path to the ZSH executable. If you are not sure where exactly ZSH has been placed, you can use this command to find it:

which zsh

This command prints the absolute path to ZSH executable (if it’s installed).

By editing the ~/.zshrc file you can adjust the shell’s configuration depending on your needs. We recommend to explore OhMyZsh plugins. Furthermore, you need to edit the following line in the configuration file (~/.zshrc) to add or remove plugins:

plugins=(git bundler osx rake ruby)

For example, if you work with Symfony framework, you might be interested in the “symfony” or “symfony2” plugin which add autocomplete for Symfony command line operations. Or, if you use GIT it might be useful to see current branch name and even more – to have autocomplete for git branch names, use “git” plugin for this purpose:


Also, if you like to “move your furniture around the flat” from time to time – there are many built in themes for ZSH in this configuration. To change the theme you need to edit the following line in the configuration file:


You can find the list of themes with the screenshots here

Now you can enjoy ZSH features such as shared commands history, enhanced autosuggestions, shared commands history, plugins etc. Therefore, try to start by hitting ctrl+r – you will get an ability to search in the commands history – no more reasons to grep your .bash_history every time.

We hope you will like it. In the next articles we are going to describe the handy way to use multi windows configurations for your shell and other useful things. Thanks for reading us and good luck in learning the CLI zen.