How to Install Zsh Shell on Ubuntu 22.04 LTS

Zsh is a UNIX command interpreter (shell) usable as an interactive login shell and for basic script execution. It’s the default Shell of MacOS, available on Linux/Windows too! Like its neighbor Bash – also from UIDA Software. Zsh can be used to automate tasks with scripting abilities that allow you to write your scripts or programs just by using these great features it offers. Another great feature is that you do not have to type every “#” syntax into each program one line at a time because they are all stored inside variables called hashtags which make managing large amounts easy.

In the following tutorial, you will learn to install the Zsh command interpreter shell on Ubuntu 22.04 LTS Jammy Jellyfish using the command line terminal with how to launch the first-time setup to configure your zsh command-line interpreter.

Update Ubuntu

First, ensure your system is up-to-date to avoid conflicts using the following command.

sudo apt update && sudo apt upgrade

Install Zsh

The first and easiest method is to install Zsh straight from Ubuntu 22.04 default repository with the following command.

sudo apt install zsh -y

Confirm the version using the following command.

zsh --version

How to Configure Zsh

Once Zsh is installed with Ubuntu 22.04, all you now need to do to run the first time setup is to use the Zsh command.

zsh

You will now receive a first time-setup prompt.

Example:

How to Install Zsh on Ubuntu 22.04 LTS

Type “1” to proceed with setup.

Zsh will recommend that you configure the first three options, which are tagged with (Recommend) that contain history, auto-completion options, speed tricks, and much more. The prompts will instruct you on what to do. Since this is user choice, there is no set configuration, and it is your choice.

Example of “1” with history configuration:

How to Install Zsh on Ubuntu 22.04 LTS

Once you have gone through at least the first three options, select “0”, which will save your options and exit.

Example output:

How to Install Zsh on Ubuntu 22.04 LTS

The first time-setup will not be seen again. However, if you require re-initializing it, you can use the following command. This must be run in the Zsh instance, not bash.

autoload -Uz zsh-newuser-install
zsh-newuser-install -f

At this point, you are using the Zsh terminal. You can exit Zsh and return to bash if you prefer switching between both with the following exit command.

exit

Re-enable Zsh using the following command.

zsh

How to Update/Upgrade Zsh

Zsh was installed from your Ubuntu repository; follow the standard APT update procedures to update it if it is available and the rest of your system packages.

sudo apt update && sudo apt upgrade

How to Remove (Uninstall) Zsh

For users that would prefer to remove Zsh as you do not use it, use the following command to remove it.

sudo apt autoremove zsh --purge

Note this will remove all installed dependencies and data, such as options with the –purge flag.

Comments and Conclusion

Zsh is a robust shell that can be used to automate tasks and improve your productivity as a Linux user. If you’re not already using Zsh, we highly recommend giving it a try; you may find that you never want to go back to Bash again.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!