bo3bdo Blog


How to Install ZSH on Ubuntu 22.04 LTS | Bash to ZSH And oh-my-zsh

Published 10 months ago 9 min read 206 comments 9 min read Ubuntu
echo "export PATH=$PATH:$HOME/.config/composer/vendor/bin" >> ~/.zshrc
source ~/.zshrc

Update Ubuntu

How To Install ZSH on Ubuntu

We have to install the ZSH using this command:

sudo apt install zsh
sudo apt install git

How to Install ZSH on Ubuntu 22.04 LTS | Bash to ZSH/Ubuntu /How to Install ZSH on Ubuntu 22.04 LTS | Bash to ZSH

  •  September 22, 2021 
  •  admin 
  •  Ubuntu

How to Change the Default Shell to ZSH on UbuntuIn this article, we are going to learn about how to install ZSH on Ubuntu. And how to change the default shell to ZSH on Ubuntu. ZSH (Z Shell) is a better alternative to the Bash shell, in ZSH we can modify the terminal and make our terminal colorful as we like.

What is ZSH

ZSH also is known as Z shell, is a Unix shell that 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, or many more plugins and theme support.

Before installing Zsh: Dependencies

Packages that are supportive to Zsh you need to install:

  • Install the git, wget, curl packages.
  • 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.

Update the Ubuntu

First of all we have to update out Ubuntu using following command:

$ sudo apt update


Update Ubuntu

How To Install ZSH on Ubuntu

We have to install the ZSH using this command:

$ sudo apt install zsh

Complete Switch from BASH to ZSH

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

$ sudo chsh -s /bin/zsh <username>

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

$ sudo vim /etc/passwd


Passwd File in Ubuntu

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.

Note: Reboot you Ubuntu after this changes. Abd then open the terminal and choose the 2 option there first time.

Change the ZSH Themes

Install oh-my-zsh

oh-my-zsh Vai Curl

$ sh -c "$(curl -fsSL"

Installing oh-my-zsh Vai wget

$ sh -c "$(wget -O -)"

Install zsh-autosuggestions

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

Install zsh-syntax-highlighting

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

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.

$ sudo nano /home/username/.zshrc


How to Install ZSH on Ubuntu

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=”robbyrussell” and your Zsh theme will be changed.

➜  ~ ls /home/linuxips/.oh-my-zsh/themes 
3den.zsh-theme             kennethreitz.zsh-theme
adben.zsh-theme            kiwi.zsh-theme
af-magic.zsh-theme         kolo.zsh-theme
afowler.zsh-theme          kphoen.zsh-theme
agnoster.zsh-theme         lambda.zsh-theme
alanpeabody.zsh-theme      linuxonly.zsh-theme
amuse.zsh-theme            lukerandall.zsh-theme
apple.zsh-theme            macovsky-ruby.zsh-theme
arrow.zsh-theme            macovsky.zsh-theme
aussiegeek.zsh-theme       maran.zsh-theme
avit.zsh-theme             mgutz.zsh-theme
awesomepanda.zsh-theme     mh.zsh-theme
bira.zsh-theme             michelebologna.zsh-theme
blinks.zsh-theme           mikeh.zsh-theme
bureau.zsh-theme           miloshadzic.zsh-theme
candy-kingdom.zsh-theme    minimal.zsh-theme
candy.zsh-theme            mira.zsh-theme
clean.zsh-theme            mlh.zsh-theme
cloud.zsh-theme            mortalscumbag.zsh-theme
crcandy.zsh-theme          mrtazz.zsh-theme
crunch.zsh-theme           murilasso.zsh-theme
cypher.zsh-theme           muse.zsh-theme
dallas.zsh-theme           nanotech.zsh-theme
darkblood.zsh-theme        nebirhos.zsh-theme
daveverwer.zsh-theme       nicoulaj.zsh-theme
dieter.zsh-theme           norm.zsh-theme
dogenpunk.zsh-theme        obraun.zsh-theme
dpoggi.zsh-theme           peepcode.zsh-theme
dstufft.zsh-theme          philips.zsh-theme
dst.zsh-theme              pmcgee.zsh-theme
duellj.zsh-theme           pygmalion-virtualenv.zsh-theme
eastwood.zsh-theme         pygmalion.zsh-theme
edvardm.zsh-theme          random.zsh-theme
emotty.zsh-theme           re5et.zsh-theme
essembeh.zsh-theme         refined.zsh-theme
evan.zsh-theme             rgm.zsh-theme
fino-time.zsh-theme        risto.zsh-theme
fino.zsh-theme             rixius.zsh-theme
fishy.zsh-theme            rkj-repos.zsh-theme
flazz.zsh-theme            rkj.zsh-theme
fletcherm.zsh-theme        robbyrussell.zsh-theme
fox.zsh-theme              sammy.zsh-theme
frisk.zsh-theme            simonoff.zsh-theme
frontcube.zsh-theme        simple.zsh-theme
funky.zsh-theme            skaro.zsh-theme
fwalch.zsh-theme           smt.zsh-theme
gallifrey.zsh-theme        Soliah.zsh-theme
gallois.zsh-theme          sonicradish.zsh-theme
garyblessington.zsh-theme  sorin.zsh-theme
gentoo.zsh-theme           sporty_256.zsh-theme
geoffgarside.zsh-theme     steeef.zsh-theme
gianu.zsh-theme            strug.zsh-theme
gnzh.zsh-theme             sunaku.zsh-theme
gozilla.zsh-theme          sunrise.zsh-theme
half-life.zsh-theme        superjarin.zsh-theme
humza.zsh-theme            suvash.zsh-theme
imajes.zsh-theme           takashiyoshida.zsh-theme
intheloop.zsh-theme        terminalparty.zsh-theme
itchy.zsh-theme            theunraveler.zsh-theme
jaischeema.zsh-theme       tjkirch_mod.zsh-theme
jbergantine.zsh-theme      tjkirch.zsh-theme
jispwoso.zsh-theme         tonotdo.zsh-theme
jnrowe.zsh-theme           trapd00r.zsh-theme
jonathan.zsh-theme         wedisagree.zsh-theme
josh.zsh-theme             wezm+.zsh-theme
jreese.zsh-theme           wezm.zsh-theme
jtriley.zsh-theme          wuffers.zsh-theme
juanghurtado.zsh-theme     xiong-chiamiov-plus.zsh-theme
junkfood.zsh-theme         xiong-chiamiov.zsh-theme
kafeitu.zsh-theme          ys.zsh-theme
kardan.zsh-theme           zhann.zsh-theme

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

➜  ~ ls /home/linuxips/.oh-my-zsh/plugins/
adb/                       docker-machine/            history-substring-search/  osx/                       sudo/                    
ag/                        doctl/                     hitchhiker/                otp/                       supervisor/              
aliases/                   dotenv/                    hitokoto/                  pass/                      suse/                    
alias-finder/              dotnet/                    homestead/                 paver/                     svcat/                   
ansible/                   droplr/                    httpie/                    pep8/                      svn/                     
ant/                       drush/                     invoke/                    percol/                    svn-fast-info/           
apache2-macports/          eecms/                     ionic/                     per-directory-history/     swiftpm/                 
arcanist/                  emacs/                     ipfs/                      perl/                      symfony/                 
archlinux/                 ember-cli/                 isodate/                   perms/                     symfony2/                
asdf/                      emoji/                     iterm2/                    phing/                     systemadmin/             
autoenv/                   emoji-clock/               jake-node/                 pip/                       systemd/                 
autojump/                  emotty/                    jenv/                      pipenv/                    taskwarrior/             
autopep8/                  encode64/                  jfrog/                     pj/                        terminitor/              
aws/                       extract/                   jhbuild/                   please/                    term_tab/                
battery/                   fabric/                    jira/                      pm2/                       terraform/               
bazel/                     fancy-ctrl-z/              jruby/                     pod/                       textastic/               
bbedit/                    fasd/                      jsontools/                 postgres/                  textmate/                
bedtools/                  fastfile/                  jump/                      pow/                       thefuck/                 
bgnotify/                  fbterm/                    kate/                      powder/                    themes/                  
boot2docker/               fd/                        keychain/                  powify/                    thor/                    
bower/                     firewalld/                 kitchen/                   profiles/                  tig/                     
branch/                    flutter/                   knife/                     pyenv/                     timer/                   
brew/                      fnm/                       knife_ssh/                 pylint/                    tmux/                    
bundler/                   forklift/                  kops/                      python/                    tmux-cssh/               
cabal/                     fossil/                    kubectl/                   rails/                     tmuxinator/              
cake/                      frontend-search/           kubectx/                   rake/                      torrent/                 
cakephp3/                  fzf/                       kube-ps1/                  rake-fast/                 transfer/                
capistrano/                gas/                       lando/                     rand-quote/                tugboat/                 
cargo/                     gatsby/                    laravel/                   rbenv/                     ubuntu/                  
cask/                      gb/                        laravel4/                  rbfu/                      ufw/                     
catimg/                    gcloud/                    laravel5/                  react-native/              universalarchive/        
celery/                    geeknote/                  last-working-dir/          rebar/                     urltools/                
chruby/                    gem/                       lein/                      redis-cli/                 vagrant/                 
chucknorris/               genpass/                   lighthouse/                repo/                      vagrant-prompt/          
cloudfoundry/              gh/                        lol/                       ripgrep/                   vault/                   
codeclimate/               git/                       lxd/                       ros/                       vim-interaction/         
coffee/                    git-auto-fetch/            macports/                  rsync/                     vi-mode/                 
colemak/                   git-escape-magic/          magic-enter/               ruby/                      virtualenv/              
colored-man-pages/         git-extras/                man/                       rust/                      virtualenvwrapper/       
colorize/                  gitfast/                   marked2/                   rustup/                    vscode/                  
command-not-found/         git-flow/                  mercurial/                 rvm/                       vundle/                  
common-aliases/            git-flow-avh/              meteor/                    safe-paste/                wakeonlan/               
compleat/                  github/                    microk8s/                  salt/                      wd/                      
composer/                  git-hubflow/               minikube/                  samtools/                  web-search/              
copybuffer/                gitignore/                 mix/                       sbt/                       wp-cli/                  
copydir/                   git-lfs/                   mix-fast/                  scala/                     xcode/                   
copyfile/                  git-prompt/                mongocli/                  scd/                       yarn/                    
cp/                        glassfish/                 mosh/                      screen/                    yii/                     
cpanm/                     globalias/                 mvn/                       scw/                       yii2/                    
dash/                      gnu-utils/                 mysql-macports/            sdk/                       yum/                     
debian/                    golang/                    n98-magerun/               sfdx/                      z/                       
deno/                      gpg-agent/                 nanoc/                     sfffe/                     zbell/                   
dircycle/                  gradle/                    ng/                        shell-proxy/               zeus/                    
direnv/                    grails/                    nmap/                      shrink-path/               zoxide/                  
dirhistory/                grc/                       node/                      singlechar/                zsh-interactive-cd/      
dirpersist/                grunt/                     nomad/                     spring/                    zsh-navigation-tools/    
django/                    gulp/                      npm/                       sprunge/                   zsh_reload/              
dnf/                       hanami/                    npx/                       ssh-agent/                                          
dnote/                     helm/                      nvm/                       stack/                                              
docker/                    heroku/                    oc/                        sublime/                                            
docker-compose/            history/                   octozen/                   sublime-merge/                              

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


How to Install ZSH on Ubuntu


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


How to Install ZSH on Ubuntu


If you want a custom terminal. So now you know how to install ZSH on Ubuntu. And you want to customize according to your need then you have to use ZSH with its themes and plugins. It is very easy to use and has time-saving themes. Many themes are available on the web where you have to simply download and use them without any problem. GOOD LUCK!