How to Install ZSH on Ubuntu using Oh My Zsh and Auto-suggestion on Zsh

Published on Aug. 22, 2023, 12:14 p.m.

The default Linux terminal may get your job done, but it looks dull. The third option is also an entirely different experience.

One such popular shell is Zsh . You can see its popularity from the fact that it is now the default shell in macOS.

How to Install ZSH on Ubuntu

First, let’s install the Zsh with some prerequisites:

sudo apt install zsh git fonts-font-awesome

Once you are done with the installation, you can start Zsh.

zsh

How to Customise ZSH on Ubuntu

1. Install Oh My Zsh on Ubuntu

Using Oh My Zsh is the easy way to manage Zsh’s themes.

To install Oh My Zsh, all you have to do is execute .

sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

install oh my zsh on ubuntu

2. Enable auto-suggestions on zsh

The auto-suggestion button will suggest the command based on your Zsh command history.

To add the auto-suggestion plugin, first, use the given command.

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

Now, to activate the auto-suggestion plugin:

nano ~/.zshrc

And add zsh-autosuggestions.

enable auto suggestion in zsh

Now, restart Zsh:

zsh

And now:

auto suggestion on zsh

3. Allowing syntax highlighting on Zsh.

To add the syntax highlighting using the given command:

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

Now open the zshrc file and type the following:

nano ~/.zshrc

And add zsh-syntax-highlighting to the list as shown:

enable syntax highlighting in zsh

Next, restart the terminal and start the Zsh.

zsh

And the following effect:

syntax highlighting in zsh

Change default shell on Ubuntu.

To change your default login shell, first.

chsh

And to change your default shell, enter the following path.

/bin/zsh

set zsh as a default login shell in ubuntu

Let me know if I missed something else.