24/02/2018 GNU/Linux How to install ZSH and Oh My ZSH! in GNU/Linux

How to install ZSH and Oh My ZSH! in GNU/Linux

Surely it may require more time to configure Oh My ZSH! in the way that we like it, or we are interested depending on the tools we use in our day to day, than what is its installation. When you discover Oh My ZSH! and the large number of options you have, you enter a kind of black hole in which time passes at a speed that Science can't explain. However, let's focus on the subject of this tutorial: its installation. And we are going to see how to install zsh in the main Linux distros, because the installation of Oh My ZSH! is common for all of them.

Installing ZSH


# apt install zsh


# apt install zsh


# zypper install zsh

Arch Linux

# pacman -S zsh


# emerge --ask --verbose app-shells/zsh

Surely if you use a different distro you'll know what is your package manager and how to install a new package using it.

Setting ZSH as the default shell

We have two options:

  • Configure the application we are using to display the command console.
  • Set by a command to automatically log in using zsh.

As the first option would require a lot of instructions, because depending on the application (there are lots in GNU/Linux) that we use this configuration will be located in a different place, we will focus on the second one in this tutorial, which is very simple and more useful. However, if you prefer the first option, surely Googling you will find the answer.

The command that we have to run to set zsh as our default shell is:

$ chsh -s $(which zsh)

For more information about this command:

  • chsh is the package that manages our shell.
  • The -s parameter sets the path that you type to the default shell.
  • $(which zsh) is an embedded way of run the which zsh command that shows on screen which path zsh is installed on.

Installing Oh My ZSH!

The best thing about Oh My ZSH! is that its installation, although a bit complex, we don't need but to run a command, this command runs an executable written in bash and automatically takes care of everything without us being aware of it. This is a safe executable, but when you download executables from the Internet you should take a look at the code, because otherwise we'll never know what we are actually running, and in case of being an executable from a malicious website it could be a security risk in our system. And we don't want that, right?

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

After running this command we'll have in our system Oh My ZSH! with the default settings and a nice prompt in our new and improved terminal. However, you have to know that from this moment all the configuration of both zsh and Oh My ZSH! will be in a ~/.zshrc file that will be automatically generated, from which you can change your prompt theme, add Oh My ZSH! plugins, and so on.

And you know: never stop programming!

Javi Palacios

Javi Palacios


Computer Padawan and real reader enthusiast. The first day that I code I knew that I wanted to continue programing for the rest of my life. Compiling things on Linux since 2003 and enjoying the stability of macOS since 2006. Free software and technology lover.


New comment