Zsh doesn’t just offer a better shell experience; it fundamentally changes how you interact with the command line by making it a programmable, intelligent assistant.

Let’s get Zsh installed and running. First, we need to check if it’s already there. Open your terminal and run:

zsh --version

If you see a version number, you’re good to go on that front. If not, you’ll need to install it. The command varies slightly by distribution:

  • Debian/Ubuntu:
    sudo apt update && sudo apt install zsh -y
    
  • Fedora/CentOS/RHEL:
    sudo dnf install zsh -y
    
    or
    sudo yum install zsh -y
    
  • Arch Linux:
    sudo pacman -Syu zsh
    

Once installed, you need to make it your default shell. To do this, first find the path to your Zsh executable:

which zsh

This will likely output something like /usr/bin/zsh. Now, tell your system to use it:

chsh -s $(which zsh)

You’ll be prompted for your password. After this, you need to log out and log back in for the change to take effect. When you open your terminal again, you should see a new prompt. If it’s your first time running Zsh, you’ll likely be greeted with a configuration menu.

For a guided setup, choose option (2) to process the recommended configuration file. This creates a basic .zshrc in your home directory. It’s a good starting point.

Now, let’s talk about what makes Zsh shine: plugins and themes, most famously managed by frameworks like Oh My Zsh. To install Oh My Zsh, you’ll typically use curl or wget.

Using curl:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Using wget:

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

This script automatically backs up your existing .zshrc (if any) and creates a new one with Oh My Zsh’s structure.

The .zshrc file is where the magic happens. It’s sourced every time you start a new Zsh session. Here’s a peek at a minimal .zshrc after Oh My Zsh installation:

# ~/.zshrc

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/home/youruser/.oh-my-zsh"

# Set name of the theme to load. Optionally, leave an empty string to just load
# the ow-my-zsh default theme.
# For a list of available themes, run: 'ls $ZSH/themes/'
ZSH_THEME="robbyrussell"

# Uncomment the following line to disable auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how oh-my-zsh updates (between daily, weekly, etc.)
# export UPDATE_ZSH_DAYS=7

plugins=(
  git
  macos
  web-search
)

source $ZSH/oh-my-zsh.sh

# User configuration

# Example:
# export EDITOR="vim"

The ZSH_THEME variable is key for visual appeal. robbyrussell is the default, but you can change it. For example, to use the popular agnoster theme (which requires powerline fonts for full effect), you’d set:

ZSH_THEME="agnoster"

Then, you’d need to install a powerline-compatible font (like Meslo LG L DZ for Powerline) on your system and configure your terminal emulator to use it.

The plugins array is where you extend Zsh’s functionality. git is essential for anyone working with version control. web-search lets you quickly search Google, DuckDuckGo, etc., directly from the prompt. To enable these, just list their names within the parentheses. After saving your .zshrc, you can apply the changes to your current session with:

source ~/.zshrc

You can install plugins not included with Oh My Zsh by cloning them into the ~/.oh-my-zsh/custom/plugins/ directory and then adding their names to the plugins array in your .zshrc. For instance, to install zsh-syntax-highlighting:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

And then add zsh-syntax-highlighting to your plugins array. This plugin highlights commands as you type, showing you if a command is valid or not.

The most powerful, yet often overlooked, aspect of Zsh configuration is its globbing. Zsh’s globbing is significantly more advanced than Bash’s. For example, ls **/*.txt will list all .txt files in the current directory and all subdirectories recursively, a feature that in Bash requires find or shopt -s globstar. Zsh enables this by default. The real power comes with extended globbing (enabled with setopt extendedglob), which allows for complex pattern matching. For instance, ls *.+(txt|jpg) would match files ending in .txt or .jpg.

Once you’ve got Zsh and Oh My Zsh set up, the next logical step is exploring Zsh’s advanced completion system and learning how to write your own completion functions.

Want structured learning?

Take the full Zsh course →