How to Install and Use Zsh Shell in Ubuntu and Other Linux

3 min


In this guide, we explain how to install, use and configure several themes in Zsh.

I bet, all true Linux fans love Terminal. A Terminal is a way of executing commands from a user for Linux Kernel. And a way for Linux Kernel to interact with user as well. Hence, it is always much faster way of doing several activities via terminal.

If you are a system administrator managing multiple Linux desktop systems in a local network, or, organization network, then definitely you spent your most of your time in terminal. If you use a desktop environment for those work, then you might want to change the look of your terminal for a change. Getting away from the mundane default terminals of Ubuntu and other Linux systems.

By default, almost of all Linux distributions uses Bash shell. The bash shell is a solid program and an old one too. But it lacks certain customization options. For example, if you want some nice colors, execution time for commands, etc. – it is difficult to customize.

So, for those customizations, you can use the Zsh shell, which is in a way an extended Bash Shell with additional improvements. 

And in this guide, we explain how to install, use and configure several themes in Zsh. This applies to all Linux distributions

Install zsh

Installing Zsh is easy. Following command does the trick.

Ubuntu, Debian, Linux Mint and all related distro

sudo apt install zsh

Fedora

sudo dnf install zsh

Arch

pacman -S zsh

Configure and use zsh

After installation, you need to configure the Zsh and replace your bash shell. To do that, open the terminal and run the below command. Change the username as per your system (root in below example).

  • First, find out the executable path of Zsh.
whereis zsh
  • Then change the Shell using
chsh -s /usr/bin/zsh root
Changing Shell
Changing Shell
  • Then logoff and login again and open the terminal. You should see a first time setup screen. Choose 0. This should create an empty .zshrc file.
zsh configuration
zsh configuration

And now it’s time to colorize Zsh.

Install and Configure Oh My Zsh

Oh My Zsh is a collection of script and themes which gives the actual look and feel of your terminal. It is present in GitHub which you need to download and install. Follow the steps below.

  • If Git is not installed, install it via sudo apt install git Or, sudo dnf install git.
  • Then run the following command.
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh

Or, you can use any of the below method for install.

MethodCommand
curlsh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
wgetsh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fetchsh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  • Above command will install the Oh My Zsh and create a configuration folder in your home named .zshrc.
  • Copy the templates.
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
  • Compile the Zsh again.
source ~/.zshrc
  • And, you should see a nice looking terminal prompt.
oh my zsh install
oh my zsh install

Changing Themes

See the above screen prompt. That is the default prompt. Now, Oh My Zsh preloaded with many themes. They are located in ~/.oh-my-zsh/themes. See below.

pre-loaded themes
pre-loaded themes

How they look, you can find it here. Its good idea to browse through first, before making a change.

Now, to change a theme, note down the name from above and update it in ~/.zshrc file via any text editor. For this tutorial, I will change to agnoster theme.

In the file, change the name of ZSH_THEME property with the theme name. Save and close the file.

changing the theme name
changing the theme name

Compile the .zshrc file again.

source ~/.zshrc

Close and open the terminal again. And you should be seeing the new theme in action.

oh my zsh - theme applied
oh my zsh – theme applied

Closing Notes

I hope this guide helps you to transform your otherwise mundane Terminal. You can play around with various themes and settle with what you like. You can also learn more configuration options in detail in the official GitHub page or in Arch Wiki.

Let me know whether you are able to change your terminal. Also share your terminal screenshot in the comment box below. Cheers.


We bring the latest tech, software news and stuff that matters. Stay in touch via Telegram, Twitter, YouTube, and Facebook and never miss an update!

Join our Telegram channel and stay informed on the move.

Also Read


Like it? Share with your friends!

Arindam

Creator of debugpoint.com. All time Linux user and open-source supporter. Connect with me via Telegram, Twitter, LinkedIn, or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

3 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
3
0
Would love your thoughts, please comment.x
()
x