Oh My Zsh is a framework for zsh (Z Shell) configuration. It gives easy access to many plugins and themes. Zsh has multiple features that speed up work with terminal.

Zsh changed the way of how I think of working with the terminal. Now working with it, especially when using right plugins, feels powerful, joyful and additionally it looks pretty amazing.

Getting started

Installation

To make your terminal awesome, first you need to install zsh, you should be able to do this by package manager of your choice e.g. 

sudo apt install zsh

 

Next thing install oh-my-zsh. To do this you need to have installed git and wget or curl, but you probably have it all already covered.

 

You can install oh-my-zsh via wget:

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

 

or via curl:

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

Plugins

Oh-my-zsh comes with a bunch of plugins ready to be used. They make work with terminal easier. Here you have some plugins:

  • svn, git, gitignore – those can help you with version control systems
  • debian, yum, ubuntu, archlinux – aliases for different package managers
  • django,perl, ruby, rails, symfony2, composer – aliases and useful scripts for different languages and frameworks
  • docker, docker-compose – scripts and aliases dedicated to work with docker

All available plugins by default should be in directory ~/.oh-my-zsh/plugins/.

To enable the chosen ones you need to change the array plugin in .zshrc file which should be at your $HOME.

You may find more about plugins on oh-my-zsh github.

Themes

Themes are config files that adjust the look of your terminal. As with plugins, oh-my-zsh comes with a bunch of them to choose from. By default, they are in ~/.oh-my-zsh/themes/, and to change the theme you need to adjust the ZSH_THEME in your .zshrc file.

Most of the themes have screenshots at oh-my-zsh github page

Note: many themes require installing the Powerline Fonts in order to render properly.

Some of my favorite features

Let me introduce you to some of my favorite features of zsh, those are the things that I find most helpful and use most often.

I won’t cover any advanced fancy things, only basic features of zsh, but still this might be helpful if you haven’t known it before.

‘cd’ completion with TAB

The command that we all use – change directory. 

In bash when you press Tab you get prompted of all directories in the current location, but then you still need to type the name of directory by yourself, or at least a part of it, till it will be unique for autocompleter to complete it.

With Zsh when you double press Tab, you can navigate through the prompted directories by keyboard, by pressing Tab, which highlights the next position or by arrow keys, press Enter to add highlighted position to typed path.

Path completion

You don’t have to type whole directory names, just type the first few letters enough to make it unique press Tab and Zsh will work the rest out.

Expand environment variables

You can have environment variables available in your shell and sometimes you may want to check their values. With zsh is as easy as pressing the Tab key.

Prompting command switches

When you try to figure out how a command works, you often execute it without any parameters or with –help. Zsh gives you another option, just type the start of the switch (-) and press Tab and it prompts with a list of switches with inline documentation. It’s even possible to navigate through the list with arrow keys.

You may need to enable some plugins for this to work with some commands.

Better history

I use to use Ctrl + R to find a specific command I used in the past. Now with zsh is as easy as pressing up arrow key. By just start typing the command and using the arrow keys, you can cycle through a past command that starts with what you just typed.

Press up key to cycle through all history

Start typing a command and use arrows to find previous usages of this command

Git

Zsh comes with some features that help to work with git.
When you enter a git ctalog it shows you on which branch you’re currently working. It also indicates if you have some uncommitted changes.


Here you can see that the active branch is develop and the green color means that there are none uncommitted changes.


The yellow color means that there are some uncommitted changes, the circle means that those are not staged and the + icon means that changes are staged and ready to commit.

Zsh has also a bunch of aliases to use with git.

Summary

It’s just a quick look at oh-my-zsh basic features, which, I hope will interest you.

If you’re already using oh-my-zsh, share your favorite configuration with us in the comments!