Skip to content

Shell

In most Linux distributions, including the Ubuntu, the default shell is bash. Though which shell you use is almost fully based on preference and workflow, in this document we show how to set up ZSH with some recommended plugins and theming.

ZSH

ZSH (or Z shell) is an extended version of the Bourne Shell (sh), with new features, and support for plugins and themes. In addition, ZSH has many of the same features as bash, so switching won’t be a hassle. We will use the Oh My Zsh framework to manage our ZSH configuration, powerlevel10k as our theme, and zsh-autosuggestions for fish-like autosuggestions.

Installing ZSH

First, let’s install ZSH:

Terminal window
sudo apt install zsh

We can verify our installation by running zsh --version, which should yield an output of the version number. Next, we need to make it our default shell:

Terminal window
chsh -s $(which zsh)

After that restart your terminal, and test if it worked with echo $SHELL, it should output /usr/bin/zsh.

Installing Oh My Zsh

Terminal window
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

All ZSH configuration is stored in .zshrc. Here you will find such configuration as ZSH_THEME, and plugins.

ZSH plugins

By default, Oh My Zsh installs the git plugin https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git, it comes with very powerful aliases and some useful functions. For more plugins look at the Oh My Zsh wiki: https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins.

One other recommended plugin is zsh-autosuggestions (https://github.com/zsh-users/zsh-autosuggestions). To install:

Terminal window
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Finally, make sure to add it to the plugin list in your .zshrc:

Terminal window
plugins=(
# other plugins...
zsh-autosuggestions
)

Installing powerlevel10k

One theme that you can use is powerlevel10k. It works really well with git and other plugins. They recommended installing their font: https://github.com/romkatv/powerlevel10k#meslo-nerd-font-patched-for-powerlevel10k, though it is optional. Assuming you have Oh My Zsh installed, we can install powerlevel10k using:

Terminal window
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Then set ZSH_THEME="powerlevel10k/powerlevel10k" in your ~/.zshrc, and restart your terminal. After restart the configuration wizard should show (otherwise run p10k configure).