How to get ZSH installed on Linux

How to get ZSH installed on Linux

 

How to get ZSH installed on Linux

Z shell (Zsh) is without doubt one of the strongest shell interpreters which is an prolonged model of bash, tcsh and ksh. It’s a extremely popular command-line productiveness instrument for net developer’s workflow.

A few of the outstanding options are:

  • Higher tab completion
  • Simple listing navigation
  • Helps numerous Themes and Plugins
  • Syntax highlighting
  • Auto completion
  • Interactive configuration
  • Shade customization

On this tutorial, I’ll present you how you can set up zsh and configure ‘Oh my zsh’ framework on the Linux machine.

Set up ZSH on Linux

By default, Ubuntu and Debian distros wouldn’t have zsh. To put in zsh on ubuntu 20.04 and Debian 10, run:

$ sudo apt set up zsh

On CentOS 8:

$ sudo yum set up zsh

To confirm the zsh set up:

$ which zsh
/usr/bin/zsh

From the output you may see, zsh has been efficiently put in in /usr/bin/zsh.

Change the present shell

First, verify what shell you’re at the moment operating on by the next echo command:

$ echo $0
-bash

The above output reveals the at the moment utilizing shell is ‘bash’. To vary the default shell, you need to run the next chsh command:

$ chsh -s $(which zsh)

Logout from the present session, now while you log in to terminal you should have Zsh shell as a substitute of default bash.

$ echo $0
-zsh

Notice: On CentOS Eight set up ‘util-linux-user’ bundle to have chsh:

$ sudo dnf set up util-linux-user

or

$ sudo yum set up util-linux-user

Set up ‘Oh my zsh’ Framework

Oh My Zsh is an open-source framework that runs on prime of Zsh. It comes with numerous options, themes, and plugins.

Firstly, you need to set up wget and git for downloading the mandatory installer instruments:

On Ubuntu:

$ sudo apt set up git wget

On CentOS:

$ sudo dnf set up wget git

Then, obtain the Oh My Zsh set up script, run:

$ wget https://github.com/robbyrussell/oh-my-zsh/uncooked/grasp/instruments/set up.sh -O – | zsh

Output:

How to get ZSH installed on Linux

The set up folder is ‘~/.oh-my-zsh’, run ls command to listing its contents:

$ ls ~/.oh-my-zsh
CODE_OF_CONDUCT.md LICENSE.txt cache lib oh-my-zsh.sh templates instruments
CONTRIBUTING.md README.md customized log plugins themes

Subsequent, you need to create a configuration file for the zsh shell. You may copy the configuration template from ‘~/.oh-my-zsh’ folder to your own home listing:

$ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
$ supply .zshrc

How to get ZSH installed on Linux

Now on operating ls command, you’ll discover a brand new look.

Easy methods to Change the theme

By default, Oh-my-zsh makes use of ‘robbyrussell’ theme. Yow will discover that by opening the .zshrc file:

.zshrc

# In the event you come from bash you might need to alter your $PATH.
# export PATH=$HOME/bin:/usr/native/bin:$PATH

# Path to your oh-my-zsh set up.
export ZSH=$HOME/.oh-my-zsh

# Set title of the theme to load — if set to “random”, it would
# load a random theme every time oh-my-zsh is loaded, during which case,
# to know which particular one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME=”robbyrussell”

There are various different themes accessible and in ~/.oh-my-zsh/themes/ listing.

$ ls ~/.oh-my-zsh/themes

How to get ZSH installed on Linux

To vary the default theme, edit the .zshrc file and alter the default theme.

For instance to alter the theme to ‘kiwi’ replace as proven:

How to get ZSH installed on Linux

Then, apply the change by operating:

$ supply .zshrc

Easy methods to Allow plugins

There are various plugins provided by Oh-my-zsh. You may listing all of them in ~/.oh-my-zsh/plugins listing.

How to get ZSH installed on Linux

So as to allow plugins, edit .zshrc file and add the corresponding plugins to the ‘plugins’ line.

For instance:

plugins=(git docker gcloud terraform vagrant)

Configure syntax spotlight on Zsh

If you wish to allow the syntax spotlight on Zsh shell, clone the zsh-syntax-hightlighting from github and transfer it to plugins folder:

$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
$ mv zsh-syntax-highlighting ~/.oh-my-zsh/plugins

Then, insert the next line on the finish of the ~/.zshrc file:

$ echo “supply ~/.oh-my-zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh” >> ~/.zshrc
$ supply ~/.zshrc

Configure autosuggestions on Zsh

When you kind a command on zsh shell, it’s helpful if the shell helps the autosuggestions mechanism. Thankfully, oh-my-zsh helps this characteristic very nicely.

To allow auto-suggestion set up zsh-autosuggestions plugin:

$ git clone https://github.com/zsh-users/zsh-autosuggestions
$ mv zsh-autosuggestions ~/.oh-my-zsh/customized/plugins

Then add the plugin to the listing of plugins in ~/.zshrc file:

plugins=(git docker gcloud terraform vagrant zsh-autosuggestions)

Now apply the change by operating:

$ supply ~/.zshrc

Conclusion

On this tutorial, we realized how you can set up and configure ZSH on Ubuntu 20.04 and CentOS Eight machines.

Fish shell is one other good various, value attempting for a greater terminal expertise. Thanks for studying and please go away your suggestion within the beneath remark part.

install zsh without root,install zsh windows 10,how to install zsh on mac,uninstall zsh mac,zsh version,chsh: /usr/local/bin/zsh: non-standard shell,zsh default without chsh,chsh: pam: authentication failure,chsh shell not changed,install powerlevel10k,install oh my zsh,ubuntu change default shell,you may not change the shell for 'root'.,upgrade_oh_my_zsh: command not found,install oh-my-zsh ubuntu,install zsh ubuntu wsl,uninstall zsh ubuntu,install zsh-autosuggestions,manjaro-zsh-config,arch oh-my-zsh,ohmyzsh on manjaro,install zsh manjaro kde,powerlevel10k arch,unable to locate package zsh,debian install git,powerlevel9k,zsh vs bash,powerlevel10k,zsh-syntax-highlighting,oh my zsh themes,zsh-autosuggestions,homyzsh,oh-my-zsh git plugin,oh-my-zsh docker plugin,install zsh ubuntu,zsh themes,zsh plugins,install zsh mac,zsh is not installed. please install zsh first.

More Stories
Apple unveils M1-powered Macs, and Microsoft Windows 10 is the big loser