What is ZSH and why would you use it instead of Bash?

ZSH, also called Z-Shell, is an enhanced version of the Bourne Shell (sh) with many new features and support for plugins and themes. Since it’s based on the same shell as Bash, ZSH has many of the same features, and toggling it is a breeze.

So why use it?

ZSH has too many functions to list some small improvements to Bash here, but here are some of the most important ones:

  • Automatic CD: Just enter the name of the directory
  • Recursive path expansion: To the example “/ U / lo / b” is expanded to “/ usr / local / bin”
  • Spelling correction and approximate completion: If you make a small mistake entering a directory name, ZSH will fix it for you
  • Plugin and theme support: ZSH includes many different plugin frameworks

Plugin and theme support is probably the coolest feature of ZSH and that’s what we’re going to focus on here.

Install ZSH

If you’re using macOS and Home brewery installed (which you should) you can install ZSH with a single command:

brew install zsh

For macOS users too, you should probably use iTerm instead of the native Terminal as it has much better color support (and many other features).


If you’re using Linux, the commands may vary depending on your distribution, but it should be a standard package in your package manager. You can advise these instructions if you have trouble.

If you’re using Windows, you might not even have bash. You can follow this guide to set this up and enable ZSH.

Installation of Oh-My-Zsh

Oh-my-zsh is the most popular plugin framework for ZSH and contains many built-in plugins and themes. There are a couple of other plugin frameworks as well, including antigenwhich is a full package manager for ZSH, but Oh-My-Zsh has many plugins built right in and does its job well.

Oh-My-Zsh has a simple installation script that you can run:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

From there, you can enable and disable plugins by adding them to your .zshrc file, which is in your ~ directory.

A complete list of the plugins is available on the Oh-My-Zsh repository.

subjects

There are many issues that one can work around, however powerlevel9k is by far the coolest. It adds a right aligned infobox, integration with Git and command history, incredible customizations, and wraps everything into a sleek user interface based on the power line Plugin for vim.


You should be using iTerm on macOS or any terminal with 24-bit color to get the most out of powerlevel9k (or really any ZSH theme).

To set up powerlevel9k (if you have Oh-My-Zsh installed) just clone the repository into the custom theme folder .oh-my-zsh:

git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k

Then you need to enable it in .zshrc:

ZSH_THEME="powerlevel9k/powerlevel9k"

After that, enter your .zshrc file and you should see the changes applied.

If you want, you can customize the default prompt by defining POWERLEVEL9K_LEFT_PROMPT_ELEMENTS in your .zshrc. Here is mine, with a minimal prompt:

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs dir rbenv)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(root_indicator background_jobs status load)

You will find the full documentation for powerlevel9k in the repo.

Linux commands
Filestar · pv · cat · tac · chmod · grep · difference · sed · With · man · pushed · popd · fsck · Test disk · seq · fd · pandoc · CD · $ PATH · awk · join · jq · wrinkles · unique · Journalctl · tail · stat · ls · fstab · echo · fewer · chgrp · chown · rev · look · Strings · Type · rename · Postal code · unzip · assemble · ummount · To install · fdisk · mkfs · rm · rmdir · rsync · df · gpg · weather · Nano · mkdir · from · ln · Patch · Convert · rclon · Scraps · srm
Processesalias · screen · above · kind · renice · progress · strace · system · tmux · chsh · story · at · Batch · for free · which · dmesg · chfn · User mod · ps · chroot · xargs · tty · pinkie finger · lsof · vmstat · Time out · Wall · Yes sir · kill · sleep · sudo · it is · Time · groupadd · User mod · groups · lshw · switch off · start anew · Stop · switch off · passwd · lscpu · crontab · date · bg · fg
Networkingnetstat · Ring · Trace route · ip · ss · who is · fail2ban · bmon · she · finger · nmap · ftp · curl · wget · who · who am I · w · iptables · ssh-keygen · ufw

Best Linux Laptops for Developers and Enthusiasts

Related Posts