$ sudo apt -y install zsh
I’ve been using ZSH for years now as my shell. In that time, I’ve learned a few niceties to make the experience better. Namely, I’ve found the minimal oh-my-zsh prompt keeps out of the way and the git aliases super convenient. Plugins for autosuggestions, like in the fish shell, and syntax highlighting are also quite helpful. Antigen makes keeping plugins up-to-date a breeze.
This tutorial explains how to install ZSH and set it as your default shell on Ubuntu 20.04. Plus, it details how to install and configure Antigen, oh-my-zsh, autosuggestions, and syntax highlighting.
Install ZSH.[1]
$ sudo apt -y install zsh
Register /usr/bin/zsh
as a login shell by adding its path to /etc/shells
.
Debian provides a convenient add-shell
command to accomplish this.
sudo add-shell /usr/bin/zsh
Set the default shell to zsh
.
$ chsh -s `which zsh`
Changing shell for jordan.
Password:
Shell changed.
Now, open up a fresh terminal session to start using .
Download and install Antigen.[2] There is a bug in the debian package at this time, so manually download and install it.[3]
$ wget -q git.io/antigen
$ sudo mkdir /usr/share/zsh-antigen
$ sudo mv antigen /usr/share/zsh-antigen/antigen.zsh
When the bug is fixed, you can simply install the package with Aptitude as follows.
|
Create the .antigenrc
configuration file.[4]
# Load the oh-my-zsh library
antigen use oh-my-zsh
antigen bundles <<EOBUNDLES
# Bundles from the default repo (robbyrussell's oh-my-zsh)
git
# Fish-like auto suggestions
zsh-users/zsh-autosuggestions
# Extra zsh completions
zsh-users/zsh-completions
# Syntax highlighting bundle.
zsh-users/zsh-syntax-highlighting
EOBUNDLES
# Load the theme
antigen theme robbyrussell
# Tell antigen that you're done
antigen apply
Now, from the .zshrc
file load Antigen and the .antigenrc
configuration file.
# Load Antigen
source /usr/share/zsh-antigen/antigen.zsh
# Load Antigen configurations
antigen init ~/.antigenrc
Load the updated .zshrc
configuration file.
$ source ~/.zshrc
Update the plugins as needed.[5]
$ antigen update
You should now be able to install and configure ZSH as your default shell in Ubuntu. You should also be able to setup Antigen to use oh-my-zsh and a couple of convenient plugins. If you want to automate updating your Antigen plugins with systemd, checkout the post Automatically Update Antigen.