Install and Setup ZSH on Ubuntu Linux (2024)

Install and Setup ZSH on Ubuntu Linux (1)

The default Linux terminal may get your job done but it looks boring.

Boring doesn't mean bad. It's just ... boring.

Want to spice things up? There are several ways to do that:

  • Customize the existing terminal by changing its color, fonts, backgrounds, etc
  • Use a different terminal emulator with better default settings
  • Use a different shell in your current terminal emulator

Yes! The third option also gives you an entirely different experience.

One such popular shell is Zsh. You can imagine its popularity from the fact that it has become the default shell in macOS.

ZSH (Z Shell) allows you to add plugins and themes by which you can tweak the whole terminal experience. Here's an example.

Install and Setup ZSH on Ubuntu Linux (2)

Pretty cool. Right?

In this tutorial, I'll share how you can set up Zsh to make your terminal look like the one in the screenshot above.

I am using Ubuntu in the tutorial but feel free to follow it on other Linux distributions except for the steps that require package installation.

Install ZSH on Ubuntu

First, let's install the Zsh with some prerequisites that will be useful in the later part:

sudo apt install zsh git fonts-font-awesome

Once you are done with the installation, you can start Zsh with the following command:

zsh

And it will give you various options to deal with the Zsh config file.

I'm going to configure everything from scratch so I will go with the option 0 to have an empty .zshrc file:

Install and Setup ZSH on Ubuntu Linux (3)

As I went with the empty config file, you will get the following prompt:

Install and Setup ZSH on Ubuntu Linux (4)

I know it looks pretty dull (worse than bash). But hang on. We are just getting started!

Customise ZSH on Ubuntu

For the customization of Zsh, I will be covering:

  • Installing Oh my Zsh (a framework to manage Zsh)
  • Auto suggesting
  • Syntax highlighting
  • Powerlevel10k (theme for Zsh)

So let's start with the Oh My Zsh.

1. Install Oh My Zsh on Ubuntu

Using Oh My Zsh is the easiest way to manage plugins and themes for Zsh.

So it will serve as a base for plugins and themes that I'm going to share in a moment.

To install Oh My Zsh, all you have to do is execute a simple script:

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

And it will ask you whether you want to change your default shell to Zsh or not. I would recommend you not to change it:

Install and Setup ZSH on Ubuntu Linux (5)

Once you press n, it will get you into the basic Oh My zsh look:

Install and Setup ZSH on Ubuntu Linux (6)

Pretty minimal by default. Isn't it?

2. Enable auto-suggestions on zsh

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

And everyone uses a couple of commands on daily basis such as commands to update the repository, list the contents of a directory, etc.

To add the auto-suggestion plugin, first, use the given command to clone the repository:

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, open the zshrc file:

nano ~/.zshrc

And add zsh-autosuggestions in the plugins:

Install and Setup ZSH on Ubuntu Linux (7)

Save changes and exit from the nano text editor.

Now, restart your terminal and start Zsh:

zsh

And it will enable the auto-suggestion:

Install and Setup ZSH on Ubuntu Linux (8)

When you type a command and get the right suggestion, you can auto-complete that part using the right arrow key.

3. Enable syntax highlighting on Zsh

The best part of using syntax highlighting is that you know whether the command you are writing is correct.

But apart from command, it is also helpful while programming.

To add the syntax highlighting on Zsh, first, you have to clone the repository 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

Next, open the zshrc file:

nano ~/.zshrc

And add zsh-syntax-highlighting to plugins as shown:

Install and Setup ZSH on Ubuntu Linux (9)

Now, save changes by Ctrl + O, hit enter, and press Ctrl + X to exit from the nano text editor.

Next, restart the terminal and start the Zsh to enable syntax highlighting:

zsh

And the syntax-highlighting should give you the following effect:

Install and Setup ZSH on Ubuntu Linux (10)

4. Customise Zsh with Powerlevek10k theme

From here, you will see major visual changes in your terminal.

So the first step is to clone the Powerlevel10k repository:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Now, you will have to change the default theme (which came with Oh My Zsh). And to change that, first, open the zshrc file:

nano ~/.zshrc

You will find the currently applied theme at the line starting with ZSH_THEME

Here, the default theme will be named robbyrussell which needs to be changed with powerlevel10k/powerlevel10k:

Install and Setup ZSH on Ubuntu Linux (11)

Save changes and restart your terminal.

Start the Zsh instance and you will be met with the configuration wizard for the powerlevel10k theme:

zsh

Here, it will ask you certain questions. It will start with Does this looks like a diamond (rotated square)? For me it doesn't:

Install and Setup ZSH on Ubuntu Linux (12)

Next, it will ask the same question but for the lock. To me, it looks like one so I will go with Yes (y):

Install and Setup ZSH on Ubuntu Linux (13)

Next, it will ask whether the icons fit between crosses. To me, it doesn't, so I'm going with No (n):

Install and Setup ZSH on Ubuntu Linux (14)

Once you answer all the questions, it will get you into prompt style selections where you have to choose how you want your terminal to look like:

Install and Setup ZSH on Ubuntu Linux (15)

From here on, it will get you various options to choose from. Select as per your preference.

And once you are done choosing the prompt style, it will get you into the instant prompt mode.

Here, I would recommend going with the Verbose option as it will create a backup config file:

Install and Setup ZSH on Ubuntu Linux (16)

And finally, press y to apply changes to the zshrc file:

Install and Setup ZSH on Ubuntu Linux (17)

Once you apply the changes, it will show the location of the new and backup config file:

Install and Setup ZSH on Ubuntu Linux (18)

Not happy with the choices you made? You can configure the powerlevel10k theme from the start using the following command:

p10k configure

Change default shell to Zsh on Ubuntu

Once you are comfortable with the customizations, you can set the Zsh as your default shell.

To change your default login shell, first, execute the given command:

chsh

And to change your default shell, enter the following path of Zsh and press enter:

/bin/zsh
Install and Setup ZSH on Ubuntu Linux (19)

But if you remember, this will serve as a basic setup so if you want to try something else, you can select from various zsh themes from GitHub.

Want to try lesser-known shells? Here you have it

Like me if you love to explore various tools, we have a dedicated guide on 9 lesser-known shells that you can try:

Beyond Bash: 9 Lesser-Known Linux Shells and Their CapabilitiesYou probably already know about the popular shells like bash and zsh. Let us explore some interesting and unique shells.It's FOSSSreenath

I hope the given guide will help you to enhance the way you communicate with your terminal and will help you to embrace the terminal.

Let me know if I missed anything or want me to cover something else.

Install and Setup ZSH on Ubuntu Linux (2024)

References

Top Articles
Armenian Tabbouleh Recipe
38 Scots Inspired Burns Night Supper Recipe Ideas
Omega Pizza-Roast Beef -Seafood Middleton Menu
Great Clips Mount Airy Nc
Bubble Guppies Who's Gonna Play The Big Bad Wolf Dailymotion
How To Fix Epson Printer Error Code 0x9e
Mr Tire Prince Frederick Md 20678
Minn Kota Paws
Vocabulario A Level 2 Pp 36 40 Answers Key
Wildflower1967
Studentvue Columbia Heights
Craigslist Farm And Garden Tallahassee Florida
Craigslist Blackshear Ga
Bj Alex Mangabuddy
Willam Belli's Husband
Ess.compass Associate Login
Fraction Button On Ti-84 Plus Ce
Golden Abyss - Chapter 5 - Lunar_Angel
Nine Perfect Strangers (Miniserie, 2021)
Welcome to GradeBook
Palm Springs Ca Craigslist
Morristown Daily Record Obituary
Katie Sigmond Hot Pics
Noaa Duluth Mn
Touchless Car Wash Schaumburg
Happy Life 365, Kelly Weekers | 9789021569444 | Boeken | bol
Lisas Stamp Studio
Seeking Arrangements Boston
Lost Pizza Nutrition
Sand Dollar Restaurant Anna Maria Island
Democrat And Chronicle Obituaries For This Week
Movies - EPIC Theatres
Spy School Secrets - Canada's History
MethStreams Live | BoxingStreams
How to Draw a Bubble Letter M in 5 Easy Steps
Boondock Eddie's Menu
Bozjan Platinum Coins
Tra.mypatients Folio
Suspect may have staked out Trump's golf course for 12 hours before the apparent assassination attempt
Retire Early Wsbtv.com Free Book
Acadis Portal Missouri
Anya Banerjee Feet
How Many Dogs Can You Have in Idaho | GetJerry.com
Ladyva Is She Married
Gon Deer Forum
Paperlessemployee/Dollartree
Rheumatoid Arthritis Statpearls
Myapps Tesla Ultipro Sign In
Lux Funeral New Braunfels
Razor Edge Gotti Pitbull Price
Craigslist Indpls Free
Public Broadcasting Service Clg Wiki
Latest Posts
Article information

Author: Terence Hammes MD

Last Updated:

Views: 5858

Rating: 4.9 / 5 (49 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Terence Hammes MD

Birthday: 1992-04-11

Address: Suite 408 9446 Mercy Mews, West Roxie, CT 04904

Phone: +50312511349175

Job: Product Consulting Liaison

Hobby: Jogging, Motor sports, Nordic skating, Jigsaw puzzles, Bird watching, Nordic skating, Sculpting

Introduction: My name is Terence Hammes MD, I am a inexpensive, energetic, jolly, faithful, cheerful, proud, rich person who loves writing and wants to share my knowledge and understanding with you.