Zsh is a powerful interactive shell, compatible with most bash syntax, and Oh My Zsh is a popular framework that adds themes, plugins and sensible defaults. Together they make the terminal friendlier: better tab completion, command history search, git status in the prompt, and suggestions as you type.

New to shells? See sh vs bash vs zsh vs fish.

Install zsh

sudo apt install zsh git curl        # Debian/Ubuntu
sudo dnf install zsh git curl        # RHEL/AlmaLinux
zsh --version

Install Oh My Zsh

Review the installer first if you prefer, then run it as your normal user (not root):

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

It clones Oh My Zsh into ~/.oh-my-zsh, creates ~/.zshrc (backing up any existing one), and offers to make zsh your default shell. If it doesn’t:

chsh -s "$(command -v zsh)"

Log out and back in.

Choose a theme

In ~/.zshrc:

ZSH_THEME="robbyrussell"      # default, minimal
# ZSH_THEME="agnoster"        # needs a Powerline/Nerd font in your terminal
# ZSH_THEME="random"

Reload with source ~/.zshrc (or exec zsh).

Powerlevel10k is a fast, very configurable theme:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# in ~/.zshrc:
ZSH_THEME="powerlevel10k/powerlevel10k"

It runs a configuration wizard on the next start. Fancy symbols need a Nerd Font installed on your local computer (in the terminal app), not on the server.

Useful plugins

Enable plugins in ~/.zshrc:

plugins=(git sudo docker docker-compose kubectl systemd history z zsh-autosuggestions zsh-syntax-highlighting)

Built-in plugins worth knowing:

Plugin What it adds
git Many git aliases (gst, gco, gl)
sudo Press Esc twice to prefix the last command with sudo
docker, kubectl Completion and aliases
z Jump to frequently used directories (z nginx)
history Shortcuts for searching history

Two popular external plugins need cloning first:

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  • autosuggestions: greys out a suggestion from history. Press → to accept.
  • syntax-highlighting: colours commands green if valid, red if not (load it last).

Keep it fast

Too many plugins slow down shell startup, which you notice on every SSH login. Measure:

time zsh -i -c exit

Keep the plugin list short, prefer Powerlevel10k’s instant prompt, and remove plugins you don’t use.

Bring your bash settings over

Aliases and environment variables from ~/.bashrc don’t apply in zsh. Move them to ~/.zshrc, or to a shared file sourced by both. See alias command and environment variables.

Server advice

  • Keep root’s shell as bash. Rescue situations and many scripts assume it. Use zsh for your own admin user.
  • Scripts should still use #!/bin/bash or #!/bin/sh. Your interactive shell doesn’t change how scripts run.
  • On shared servers, install Oh My Zsh per user. Don’t make it a system-wide default.
  • Update Oh My Zsh with omz update.

Troubleshooting

  • Strange symbols or boxes in the prompt: the theme needs a Powerline or Nerd Font in your local terminal app. Install one there, or switch to a simple theme.
  • Slow prompt inside big git repositories: the git status check is expensive. Powerlevel10k handles this asynchronously, or disable git status for large repos.
  • “command not found” for tools that worked in bash: your PATH changes live in ~/.bashrc or ~/.profile. Copy them into ~/.zshrc (or ~/.zprofile).

Uninstall

uninstall_oh_my_zsh
chsh -s /bin/bash

Quick reference

Task Command
Install zsh sudo apt install zsh
Default shell chsh -s $(command -v zsh)
Theme ZSH_THEME="…" in ~/.zshrc
Plugins plugins=(git sudo z …)
Reload exec zsh
Startup time time zsh -i -c exit

Related: fish shell and Linux terminal shortcuts.

  • Linux
  • Shell
  • Productivity