Linux

Installing and Configuring Zsh on Linux: A Complete Guide

In this guide, you'll install the powerful Zsh shell on Linux, set up the Oh My Zsh configuration manager, and customize the interface for your tasks. Get an advanced terminal with autocompletion, command history, and handy plugins.

Updated at February 16, 2026
10-20 min
Easy
FixPedia Team
Применимо к:Ubuntu 22.04+Debian 11+Fedora 35+Arch LinuxAny Linux distribution with a package manager

Introduction / Why You Need This

Zsh (Z shell) is a modern, extensible command-line shell that offers powerful features compared to standard Bash: enhanced autocompletion, theme support, plugins, and more convenient history navigation. Installing Zsh with the Oh My Zsh configuration manager will transform your terminal into a productive environment for development and administration. After completing this guide, you will have:

  • Fast autocompletion for commands, paths, and arguments.
  • Real-time syntax highlighting.
  • Git integration (displaying branch and status).
  • Ready-to-use plugins for Docker, Kubernetes, Python, and other tools.
  • Beautiful and informative prompt themes.

Prerequisites / Preparation

Before you begin, ensure:

  1. You have access to a Linux terminal with sudo privileges (for package installation).
  2. Your distribution supports a package manager (apt, dnf, pacman, etc.).
  3. You are familiar with basic commands (cd, nano/vim, git).
  4. Recommended: Back up your current ~/.bashrc file if you wish to preserve your Bash settings.

Step 1: Install Zsh

Zsh is available in the repositories of all popular distributions. Choose the command for your system:

Ubuntu/Debian:

sudo apt update && sudo apt install zsh -y

Fedora/RHEL/CentOS:

sudo dnf install zsh -y

Arch Linux:

sudo pacman -S zsh

openSUSE:

sudo zypper install zsh

After installation, check the version:

zsh --version

Expected output: zsh 5.9 (or newer).

Step 2: Make Zsh Your Default Shell

To have Zsh start automatically each time you open a terminal, change the shell for the current user:

chsh -s $(which zsh)

⚠️ Important: which zsh returns the path to the executable (usually /usr/bin/zsh). The chsh command requires a password.

Verification: Close and reopen your terminal, or run:

echo $SHELL

The output should be: /usr/bin/zsh.

Oh My Zsh is a framework for managing your Zsh configuration. It automatically installs plugins and themes.

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

The process:

  1. The script clones the repository into ~/.oh-my-zsh.
  2. It creates a backup of your current ~/.zshrc (if it exists) and writes a basic configuration.
  3. It offers to change your shell to Zsh (if you haven't already done so).

💡 Tip: If you've already installed Zsh and set it as your default shell, the script will simply configure your ~/.zshrc.

Step 4: Configure the Prompt Theme

The theme determines the appearance of your command prompt (prompt). Popular options:

  • robbyrussell (default) — minimalist, shows Git status.
  • agnoster — informative, requires a Powerline-compatible font.
  • avit — compact, shows time and path.

Open ~/.zshrc in an editor (e.g., nano ~/.zshrc) and find the line:

ZSH_THEME="robbyrussell"

Change the value to your desired theme, for example:

ZSH_THEME="agnoster"

List of all built-in themes: ~/.oh-my-zsh/themes/.

Installing a Font for Powerline Themes (If Needed)

Themes like agnoster use special symbols. Install Nerd Fonts:

Ubuntu/Debian:

sudo apt install fonts-powerline -y

Fedora:

sudo dnf install powerline-fonts -y

Then configure your terminal (e.g., GNOME Terminal) to use the DejaVu Sans Mono for Powerline or FiraCode Nerd Font font.

Step 5: Add Plugins to Extend Functionality

Oh My Zsh plugins add commands and autocompletion for specific technologies. In the same ~/.zshrc file, find the plugins array and add the ones you need:

plugins=(
  git
  docker
  kubectl
  python
  pip
  sudo
  z
  history-substring-search
  syntax-highlighting
)

Description of key plugins:

  • git — aliases for git (gco = git checkout, gcm = git commit).
  • docker / kubectl — autocompletion for containers and Kubernetes.
  • z — quick navigation to frequently used directories (z <folder>).
  • history-substring-search — search through command history (type part of a command and press /).
  • syntax-highlighting — syntax highlighting as you type (errors in red, correct commands in green).

⚠️ Important: The syntax-highlighting plugin must be last in the list. Oh My Zsh automatically loads it if installed.

Step 6: Apply Changes and Verify

After editing ~/.zshrc, run:

source ~/.zshrc

Or restart your terminal.

What to check:

  1. Theme: The command prompt should change (displays Git branch if you're in a repository).
  2. Autocompletion: Type docker and press Tab — subcommands should appear.
  3. Plugins:
    • z Documents — will navigate to the Documents folder.
    • git status → can be shortened to gst.
  4. Syntax highlighting: Type ls /nonexistent — the path should be highlighted in red.

Verification of Results

A successful setup is confirmed by:

  • The command prompt displays information (Git branch, path, time — depending on the theme).
  • Autocompletion works without delay.
  • Plugins add aliases and commands.
  • No errors on startup (no zsh: command not found: ... messages).

Additionally, check:

echo $ZSH_VERSION  # Should show the Zsh version
echo $ZSH          # Should show the path to Oh My Zsh (~/.oh-my-zsh)

Potential Issues

Error: zsh: command not found: ... after installing a plugin

Cause: The plugin is not loaded or not installed. Solution:

  1. Ensure the plugin name is spelled correctly in ~/.zshrc.
  2. Check that the plugin exists in ~/.oh-my-zsh/plugins/.
  3. Reload the config: source ~/.zshrc.

Theme displays incorrectly (garbled characters, missing symbols)

Cause: The font does not support Powerline symbols. Solution: Install Nerd Fonts or Powerline Fonts and configure your terminal to use them.

Zsh did not become the default shell after chsh

Cause: You didn't log out/in or the path to Zsh is incorrect. Solution:

  1. Check the path: which zsh (usually /usr/bin/zsh).
  2. Log out and back in, or reboot.
  3. Verify: echo $SHELL.

Slow Zsh startup (delay >1 sec)

Cause: Too many plugins or a heavy theme. Solution:

  1. Simplify the theme (choose robbyrussell).
  2. Reduce the plugin list.
  3. Disable heavy plugins (e.g., history-substring-search can slow down search).

Conflict with other configuration managers (e.g., Prezto)

Cause: Two frameworks are managing ~/.zshrc. Solution: Remove one of them. For Oh My Zsh: delete the ~/.oh-my-zsh folder and create a clean ~/.zshrc manually.

rm -rf ~/.oh-my-zsh
echo "export ZSH=\"\$HOME/.oh-my-zsh\"" > ~/.zshrc  # Example minimal config

F.A.Q.

Zsh vs Bash: What's the difference and should you switch?
What to do if Zsh doesn't become the default shell after installation?
Can I use Zsh without Oh My Zsh?
How to switch back to Bash if you don't like Zsh?

Hints

Check current shell and install Zsh
Set Zsh as the default shell
Install Oh My Zsh (optional)
Configure theme and plugins
Apply changes and verify
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community