25 C
Jaipur
Friday, November 27, 2020

How to Install and Setup Zsh in Ubuntu 20.04

Must read

India Wearables Shipments Hit Record High in Q3 Amidst Falling Prices, Increased Options

Shipments of smart wearables in India reportedly jumped 165% in the July-September quarter thanks to an increased emphasis on remote work and rising health...

Sony is Permanently Banning PS5 Owners For Selling Their PlayStation Plus Collection

Sony offers access to 20 PlayStation 4 games through PlayStation Plus Collection, a new benefit to PlayStation Plus subscribers with PlayStation 5. The company...

This article is about installing and configuring ZSH on Ubuntu 20.04. This step applies to all Ubuntu-based distributions. ZSH stands for Z Shell which is a shell program for Unix-like operating systems. ZSH is an extended version of Bourne Shell which incorporates some features of BASH, KSH, TSH.

Zsh Features

  • Command-line completion.
  • History can be shared among all shells.
  • Extended file globbing.
  • Better variable and array handling.
  • Compatibility with shells like bourne shell.
  • Spelling correction and autofill of command names.
  • Named directories.

Installing Zsh in Ubuntu Linux

There are two ways to install ZSH in Ubuntu using an apt package manager and installing it from the source.

We will use the apt package manager to install ZSH on Ubuntu.

$ sudo apt install zsh
Install Zsh in Ubuntu

The package manager will install the latest release of ZSH which is 5.8.

$ zsh --version

zsh 5.8 (x86_64-ubuntu-linux-gnu)

Installing ZSH will not modify and set it as the default shell. We have to modify the settings to make ZSH our default shell. Use the “chsh” command with '-s' flag to switch the default shell for the user.

$ echo $SHELL
$ chsh -s $(which zsh) 
or 
$ chsh -s /usr/bin/zsh
Set Zsh Shell in Ubuntu
Set Zsh Shell in Ubuntu

Now to use the new zsh shell, log out of the terminal and log in again.

Setting Up Zsh in Ubuntu Linux

Compared to other shells like BASH, ZSH requires some first-time configuration to be taken care of. When you start ZSH for the first time it will throw you some options to configure. Let’s see what those options are and how to configure those options.

Select option “1” on the first page which will take us to the main menu.

New User Zsh Setup
New User Zsh Setup

The main menu will display some recommended options to configure.

Zsh Main Menu
Zsh Main Menu

Press 1, it will take you to configure History related parameters like how many history lines to be retained and history file location. Once you are on the “History Configuration page” you can simply type "1" or "2" or "3" to change the associated configuration. Once you make the changing status will be changed from “not yet saved” to “set but not saved”.

Zsh History Configuration
Zsh History Configuration

Press "0" to remember the changes. Once you come out to the main menu status will change from “recommended” to “Unsaved changes“.

Zsh History Configuration
Zsh History Configuration

Similarly, you have to modify the configuration for the completion system, keys, and common shell options. Once done press “0” to save all the changes.

Zsh Settings
Zsh Settings

Setup is completed now and it will take you to the shell. From next time your shell will not run through these initial setup, but you can run the new-user install command again as shown in the below image whenever needed.

Zsh Setup Completed
Zsh Setup Completed

There is an alternate and easy way instead of manually setting up each configuration. This is the way I prefer normally. Instead of choosing the option "1" and going to the main menu to set each setting, we can choose option "2" which will populate the .zshrc file with default parameters. We can change the parameters directly in the .zshrc file.

Zsh Default Parameters
Zsh Default Parameters

Revert to Old Bash Shell

In case you want to revert to the old shell you have to follow the below steps.

$ sudo apt --purge remove zsh
$ chsh -s $(which "SHELL NAME")

Now open a new session to see the changes to be effective

That’s all for this article. Take a look at our article on installing and configuring oh-my-zsh on ubuntu 20.04. Install ZSH and explore its features and share your experience with us.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

India Wearables Shipments Hit Record High in Q3 Amidst Falling Prices, Increased Options

Shipments of smart wearables in India reportedly jumped 165% in the July-September quarter thanks to an increased emphasis on remote work and rising health...

Sony is Permanently Banning PS5 Owners For Selling Their PlayStation Plus Collection

Sony offers access to 20 PlayStation 4 games through PlayStation Plus Collection, a new benefit to PlayStation Plus subscribers with PlayStation 5. The company...

cPanel 2FA Bypass Exposes Tens of Millions of Websites to Hack

Digital Defense, Inc., a leader in vulnerability and threat management solutions, announced that its Vulnerability Research Team (VRT) exposed a previously undisclosed vulnerability affecting the cPanel &...