How to Install ZSH on Ubuntu 22.04 LTS

In this article, We will show how to install ZSH on Ubuntu 22.04 LTS. My implementations of ZSH (Z shell), which is a better shell alternative to BASH, and here I will show themes and plugins which are suitable for everyone and how to install ZSH in Ubuntu to make the terminal colorful.

What you’ll learn

  • How to install ZSH in Ubuntu
  • How to update ubuntu
  • How to change bash to zsh

What you’ll need

  • Ubuntu Desktop
  • Root or Sudo-privileged user account
  • Basic Linux command line knowledge
  • Internet Connection

What is ZSH

Zsh also known as Z shell, is a Unix shell that is an extended version of the Bourne Shell (sh), with many new features and supports many plugins and themes. It is the best alternative to Bash with a cool and stylish shell interface including some features of Bash. KSH and tcsh.

Why ZSH?

ZSH is an awesome shell that just makes everything a bit simpler with its plugins like auto-suggestions, syntax-completing tasks, etc. ZSH has many features like autosuggestion, spelling correction, auto jump, syntax highlighting, and many more plugins and theme support.
Before installing Zsh: Dependencies

Packages that are supportive to Zsh you need to install it:

  • zsh – ZSH shell.
  • Oh My Zsh – it is an open-source, community-driven framework for managing your zsh configuration.
  • zsh-syntax-highlighting – This package provides syntax highlighting for the shell Zsh.
  • zsh-autosuggestions – It suggests commands as you type based on history and completions.

How To Install ZSH on Ubuntu

Update Ubuntu

$ sudo apt update

Install ZSH on Ubuntu 22.04

Installing Z Shell (ZSH)

You can install the Z shell (ZSH) using the following command:

$ sudo apt install zsh

Install ZSH on Ubuntu 22.04

After installing the Zsh we have to install the Oh My Zsh for cool themes and plugins.

Install the oh my zsh theme

Install oh my zsh Vai Curl

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

Install oh my zsh Vai wget

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

Install the plugins for zsh

Now we have to install the two plugins if you want. But we recommended one plugin which is syntax highlight.

Install zsh-autosuggestions

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

zsh-syntax-highlighting

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

BASH to ZSH on Ubuntu

Now we have to completely switch Bash to Zsh so you have to type the following command:

$ sudo chsh -s /bin/zsh [username]

Install ZSH on Ubuntu 22.04

And after that, you have to log out from the current user and log in again. Your Zsh is installed. You can check by using the following command:

$ sudo cat /etc/passwd

Install ZSH on Ubuntu 22.04

Here you can check  your user at the end from /bin/bash to /bin/zsh. So now your user shell completely changed Bash to Zsh.

Change the Zsh Themes

Now you have installed all the dependencies which are required, so now we will change the ZSH theme you have to edit the .zshrc file to change the themes.

$ nano /home/username/.zshrc

Install ZSH on Ubuntu 22.04

Selecting a Theme

Oh-My-Zsh is the main plugin framework for ZSH, and it comes with many pre-built plugins and themes, you have to just change the name of the theme ZSH_THEME="pygmalion" and your Zsh theme will be changed.

3den.zsh-theme                 Themes: switch to using ruby_prompt_info()Soliah.zsh-theme               fixed rvm warningadben.zsh-theme                use https everywhere (#6574)af-magic.zsh-theme             af-magic: fix virtualenv prompt suffixafowler.zsh-theme              avoid forking subshell to test if user is rootagnoster.zsh-theme             agnoster: fix bzr prompt with breezy installed (#8646)alanpeabody.zsh-theme          Themes: switch to using ruby_prompt_info()amuse.zsh-theme                Themes: switch to using ruby_prompt_info()apple.zsh-theme                Clean up appearance lib file and redundant `colors`arrow.zsh-theme                use https everywhere (#6574)aussiegeek.zsh-theme           aussiegeek theme (include showing rvm prompt)avit.zsh-theme                 avit: fix prompt sequence (fixes #8678)awesomepanda.zsh-theme         Fixes incorrect prompt arrow colorbira.zsh-theme                 bira: move virtualenv information (#8266)blinks.zsh-theme               blinks theme works with light and dark Solarizedbureau.zsh-theme               Use `grep -q` for silent behaviorcandy-kingdom.zsh-theme        Detect dependency plugins in candy-kingdom and kiwi themescandy.zsh-theme                localization support for clock in candy themeclean.zsh-theme                use https everywhere (#6574)cloud.zsh-theme                [cloud theme] add a space (#3215)crcandy.zsh-theme             crcandy: use 24h format in prompt (#7926)crunch.zsh-theme              Themes: switch to using ruby_prompt_info()cypher.zsh-theme              Fix graphical bug in cypher theme when return status is non-zerodallas.zsh-theme              Themes: switch to using ruby_prompt_info()darkblood.zsh-theme           Fixed darkblood theme as in issue #23.daveverwer.zsh-theme          New theme "daveverwer", based on "geoffgarside".dieter.zsh-theme              Change all hostname calls for $HOST or $SHORT_HOSTdogenpunk.zsh-theme           Fix git emptiness check in dogenpunk theme (#5329)dpoggi.zsh-theme              Added 'dpoggi' themedst.zsh-theme                 themes: fix prompt verbosity on window resizedstufft.zsh-theme             Fix tilde substitution in theme promptsduellj.zsh-theme              use https everywhere (#6574)eastwood.zsh-theme            Move current_branch() from git plugin to core lib/git.zshedvardm.zsh-theme            added my themeemotty.zsh-theme             Fix emotty theme when using zsh 5.2 (#5998)essembeh.zsh-theme           Remove all copyright information in themes. Closes #2587evan.zsh-theme               Change description for Evan's theme to something neutral (#6304)fino-time.zsh-theme          Themes: switch to using ruby_prompt_info()fino.zsh-theme               Themes: switch to using ruby_prompt_info()fishy.zsh-theme              Fix showing aws prompt for theme fishyfletcherm.zsh-theme          add fletcherm theme; a slightly modified copy of an old tonotdo themefox.zsh-theme                Remove all copyright information in themes. Closes #2587frisk.zsh-theme              Modification to the frisk theme to work with the BZR libfrontcube.zsh-theme          Themes: switch to using ruby_prompt_info()funky.zsh-theme              use https everywhere (#6574)gallifrey.zsh-theme          Actions to take after repository migration is complete (#8394)gallois.zsh-theme            Themes: switch to using ruby_prompt_info()gentoo.zsh-theme             themes: fix prompt verbosity on window resizegnzh.zsh-theme               Themes: switch to using ruby_prompt_info()intheloop.zsh-theme          Remove all copyright information in themes. Closes #2587itchy.zsh-theme             Themes: switch to using ruby_prompt_info()jaischeema.zsh-theme        Themes: switch to using ruby_prompt_info()(How to install zsh in kali linux)kiwi.zsh-theme              Detect dependency plugins in candy-kingdom and kiwi themeskolo.zsh-theme              Clean up appearance lib file and redundant `colors` calls in other fileslukerandall.zsh-theme       use https everywhere (#6574)macovsky.zsh-theme         Themes: switch to using ruby_prompt_info()maran.zsh-theme            Remove duplicate space on the maran theme (#7454)mira.zsh-theme             Themes: switch to using ruby_prompt_info()nebirhos.zsh-theme         nebirhos: use short hostname in promptnorm.zsh-theme             norm: add hg prompt (#6725)pygmalion.zsh-theme        Use safer append to hook function arrays (#8406)random.zsh-theme           random: remove random theme from possible themesrefined.zsh-theme          refined: reset command exec time (#6117)robbyrussell.zsh-theme     robbyrussell: restore prompt spacing (#8148)sunrise.zsh-theme          Upgrade some URLs to HTTPS (#8202)superjarin.zsh-theme       Merge simplified superjarin themesuvash.zsh-theme           Themes: switch to using ruby_prompt_info()tjkirch.zsh-theme          themes: fix prompt verbosity on window resizetjkirch_mod.zsh-theme      themes: fix prompt verbosity on window resizetonotdo.zsh-theme          use https everywhere (#6574)wedisagree.zsh-theme       Themes: switch to using ruby_prompt_info()wuffers.zsh-theme          adding rbenv support to all the rvm themesxiong-chiamiov-plus.zsh-theme use https everywhere (#6574)(How to install zsh in kali linux)zhann.zsh-theme Clean up appearance lib file and redundant `colors` calls in other files

Oh-My-Zsh plugins:

Oh My Zsh comes with a large number of plugins to take advantage of. You can take a look at the plugins directory ls /home/techdhee/.oh-my-zsh/plugins

Install ZSH on Ubuntu 22.04

Enabling Plugins

Once you select a plugin that you want to use with Oh My Zsh, you have to enable them in the .zshrc file. Open it with your favorite text editor and you have to see a spot to list all the plugins you want to load.

$ sudo nano /home/username/.zshrc

plugins= ( git zsh-syntax-highlighting )

Install ZSH on Ubuntu 22.04

Save the file and use the new shell with a new theme and plugins.

Install ZSH on Ubuntu 22.04

This is the way how you install the Z shell (ZSH) on Ubuntu 22.04 and how to install the oh my ZSH theme in Ubuntu. Now you can enjoy the terminal with a new look.

Conclusion

So this is the way to install the Z shell (ZSH) on Ubuntu 22.04 LTS. You can also install the Z shell (ZSH) on other Debian-based distros like Debian, Kali Linux, etc.

If you have any questions, feel free to leave a comment.

Related Posts:

Leave a Comment