Post

The Z shell

What it is

The shell is what seats between the user and the core of the operating system, usually in a form of a command line interface (CLI). The most popular shell on Linux distributions is bash. In 2019, Apple started releasing the MacOS with Zsh (Z shell) by default. I believe that is one the reasons that made zsh so popular.

Installing it on Ubuntu

Ubuntu, one of the most popular Linux distributions, comes with bash pre-installed. To install Zsh on it, just run the following commands:

1
2
$ sudo apt install zsh
$ exec zsh

When running it for the first time, it will ask you to create a default configuration file ~/.zshrc and set it as the default shell. You can make it default shell manually by running:

1
$ chsh -s $(which zsh)

The same command can be used to bring bash back. The chsh command stands for: change shell. The option -s is to set is as default during the login for the current user.

Oh My Zsh

By default, the Z shell is not very “pleasant”. It is, how ever, very extensible. Thanks to that, there is an open source project called Oh My Zsh, which makes it look super cool and productive. The project has a collection of free plugins and themes that can be easily installed using the following command.

1
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Changing the default theme is as easy as updating the variable ZSH_THEME on the ~/.zshrc file. The default is robbyrussel; a good alternative is agnoster. There a complete list of themes on a wiki page from their Github repository.

1
2
$ vi ~/.zshrc
$ source ~/.zshrc
This post is licensed under CC BY 4.0 by the author.