How to Install Zsh and Oh My Zsh
Install Zsh and Oh My Zsh on Linux, set Zsh as your default shell, configure Powerlevel10k, and add syntax highlighting and autosuggestion plugins.
Before you start
- ▸A user account with sudo privileges
- ▸git, curl or wget installed
- ▸A terminal emulator that supports custom fonts (GNOME Terminal, Konsole, Kitty, WezTerm, etc.)
- ▸Internet access to download Oh My Zsh and plugin repositories
Zsh has replaced Bash as the default shell on macOS and is increasingly popular on Linux for good reason: better tab completion, spelling correction, powerful history search, and a rich plugin ecosystem. Oh My Zsh is the community framework that makes configuring Zsh fast and practical. This guide walks through installing both, switching your default shell, adding useful plugins, and setting up the Powerlevel10k prompt theme.
Install Zsh
Most distros ship Zsh in their official repositories. Install it with your package manager.
Debian / Ubuntu
sudo apt update && sudo apt install -y zsh
Fedora / RHEL, Rocky, AlmaLinux
sudo dnf install -y zsh
Arch Linux
sudo pacman -S zsh
Confirm the install and check the version:
zsh --version
Output will look similar to zsh 5.9 (x86_64-pc-linux-gnu) — the exact version varies by distro.
Set Zsh as Your Default Shell
The chsh command changes your login shell. It writes to /etc/passwd and takes effect at the next login, not in the current terminal session.
chsh -s $(which zsh)
You will be prompted for your password. Log out and back in (or open a new terminal on Wayland/X11 desktops) to confirm the change:
echo $SHELL
It should return /usr/bin/zsh or /bin/zsh. If chsh is unavailable — common on some minimal server installs — you can add exec zsh to the end of your ~/.bash_profile as a workaround, though changing the shell properly is preferred.
Install Oh My Zsh
Oh My Zsh is installed via a shell script that clones its repository to ~/.oh-my-zsh and writes a starter ~/.zshrc. You need git and either curl or wget installed first.
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Or with wget:
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
The installer backs up any existing ~/.zshrc to ~/.zshrc.pre-oh-my-zsh, then creates a fresh one. Read the script before running it if you are security-conscious — the source is public on GitHub.
Configure Themes
Oh My Zsh ships with over 150 built-in themes. The active theme is set by the ZSH_THEME variable in ~/.zshrc. Open the file in your editor:
nano ~/.zshrc
Find the line:
ZSH_THEME="robbyrussell"
Change the value to any theme listed in ~/.oh-my-zsh/themes/. Popular built-in choices are agnoster, bira, and ys. To preview all built-in themes without committing, run:
for theme in ~/.oh-my-zsh/themes/*.zsh-theme; do
echo "--- $(basename $theme .zsh-theme) ---"
ZSH_THEME=$(basename $theme .zsh-theme) zsh -c 'source ~/.zshrc; echo $PROMPT'
done
After editing ~/.zshrc, reload the config:
source ~/.zshrc
Install Powerlevel10k
Powerlevel10k (p10k) is a high-performance external theme with an interactive configuration wizard. It requires a Nerd Font in your terminal emulator to render icons and segments correctly.
Step 1 — Install a Nerd Font
Download and install MesloLGS NF, the font recommended by Powerlevel10k's author:
mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts
curl -fLo "MesloLGS NF Regular.ttf" https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf
curl -fLo "MesloLGS NF Bold.ttf" https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf
curl -fLo "MesloLGS NF Italic.ttf" https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf
curl -fLo "MesloLGS NF Bold Italic.ttf" https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf
fc-cache -fv
Then open your terminal emulator's preferences and set the font to MesloLGS NF. On GNOME Terminal, that's Preferences → Profile → Text → Custom font. On Konsole: Settings → Edit Current Profile → Appearance → Font. WezTerm and Kitty users can set it in their config files instead.
Step 2 — Clone Powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Step 3 — Activate the Theme
Edit ~/.zshrc and update the theme line:
ZSH_THEME="powerlevel10k/powerlevel10k"
Reload the shell:
source ~/.zshrc
The interactive configuration wizard launches automatically. If it doesn't (for example after a subsequent login), trigger it manually:
p10k configure
Answer the wizard's questions about icons, prompt style, and colours. It writes your choices to ~/.p10k.zsh, which is sourced by ~/.zshrc. Run p10k configure again at any time to redesign your prompt.
Add Plugins
Oh My Zsh plugins live in ~/.oh-my-zsh/plugins/ (bundled) and ~/.oh-my-zsh/custom/plugins/ (third-party). Activate them by editing the plugins array in ~/.zshrc:
plugins=(git sudo z colored-man-pages command-not-found)
A few reliable bundled plugins worth enabling:
- git — dozens of short aliases (
gst,gco,gp, etc.) - sudo — press Esc twice to prepend
sudoto the current command - z — jump to frequently used directories by partial name
- colored-man-pages — adds colour to man pages
- command-not-found — suggests the package to install when a command is missing (requires the helper to be installed on your distro)
Install Third-Party Plugins
Two essential third-party plugins are zsh-syntax-highlighting and zsh-autosuggestions. Clone them into the custom plugins directory:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions.git \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Add them to the plugins array in ~/.zshrc. zsh-syntax-highlighting must be last:
plugins=(git sudo z colored-man-pages zsh-autosuggestions zsh-syntax-highlighting)
Reload:
source ~/.zshrc
You will immediately see typed commands highlighted in green (valid) or red (unrecognised), and grey ghost-text suggestions from your history that you accept with the right arrow key.
Keep Oh My Zsh Updated
Oh My Zsh notifies you of updates automatically. To update manually at any time:
omz update
Verification
Check that everything is in order:
echo $SHELL # should show /usr/bin/zsh or /bin/zsh
echo $ZSH_VERSION # e.g. 5.9
omz version # prints Oh My Zsh version string
Troubleshooting
- Icons show as boxes or question marks — the Nerd Font is not set in your terminal emulator. Verify the font name is exactly "MesloLGS NF" in terminal preferences, then restart the terminal.
- Shell is still Bash after chsh — you need to fully log out and back in. On display-manager-based desktops, closing just the terminal window is not enough. SSH sessions need to reconnect.
- chsh: PAM authentication failed — some systems require your user to be in a specific group or have a non-locked password. On systems where
chshfails entirely (certain LDAP or SSO setups), addexec zsh --loginto~/.bash_profileas a fallback. - Slow shell startup — too many plugins or a heavy
~/.zshrc. Profile startup time withzsh -i -c exitpreceded bytime, or usezprof: addzmodload zsh/zprofat the very top of~/.zshrcandzprofat the very bottom, then open a new shell. - p10k configure doesn't launch automatically — ensure the line
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zshexists near the bottom of~/.zshrc, added by the installer. If it's missing, add it manually.
Frequently asked questions
- Do I need Oh My Zsh to use Zsh or Powerlevel10k?
- No. Zsh works without any framework. Powerlevel10k also supports plain Zsh, Prezto, and zinit. Oh My Zsh is simply the most convenient way to manage themes and plugins for most users.
- Will changing my shell break existing Bash scripts?
- No. Scripts with a #!/bin/bash shebang always run under Bash regardless of your login shell. Only interactive sessions and scripts with #!/bin/zsh or no shebang are affected.
- How do I revert to Bash if I don't like Zsh?
- Run chsh -s $(which bash) and log out and back in. Your ~/.bashrc and ~/.bash_profile are untouched by the Zsh or Oh My Zsh installers.
- My terminal on a remote SSH server shows broken characters with Powerlevel10k. Why?
- The Nerd Font must be installed on the local machine running your terminal emulator, not on the remote server. The server only sends text; your local terminal renders it.
- How do I update Oh My Zsh and its plugins?
- Run omz update for the framework itself. Third-party plugins cloned with git must be updated separately with git pull inside their respective directories under ~/.oh-my-zsh/custom/plugins/.
Related guides
Linux Clipboards Explained (+ Clipboard Managers)
Learn the difference between Linux's PRIMARY and CLIPBOARD selections, use xclip, xsel, and wl-clipboard from the terminal, and manage history with GPaste or Klipper.
Configure LibreOffice for Daily Use
Configure LibreOffice for daily use: set default save formats for MS Office interop, tune autosave, install fonts, and add productivity extensions.
Configure the Touchpad and Multitouch Gestures
Configure Linux touchpad behavior and multitouch gestures using libinput, libinput-gestures, and native GNOME and KDE Plasma settings on both Wayland and X11.
Wayland vs X11: How to Choose and Configure Each
Know when to run Wayland or X11, how to check your current session, switch at login with GDM/SDDM/LightDM, and handle NVIDIA and XWayland edge cases.