How to Install Zsh on Ubuntu 26.04, 24.04 and 22.04

Install Zsh on Ubuntu 26.04, 24.04, and 22.04 using APT. Covers Oh My Zsh, plugins, themes, default shell setup, and removal.

Last updatedAuthorJoshua JamesRead time8 minGuide typeUbuntu

Zsh becomes worth installing on Ubuntu when Bash starts to feel too bare for daily terminal work: completion is smarter, command history is easier to reuse, and prompts can show Git or directory context without a custom script. Ubuntu 26.04 and 24.04 package Zsh 5.9, while Ubuntu 22.04 packages Zsh 5.8.1, so the standard APT install gives every supported LTS release a stable Z Shell setup.

The workflow keeps the base shell separate from optional customization. Use the Ubuntu package alone for a lightweight login shell, add APT-packaged plugins when you want distro-managed auto-suggestions and syntax highlighting, or install Oh My Zsh when you prefer its larger theme and plugin ecosystem.

Choose a Zsh Setup on Ubuntu

The right setup depends on how much configuration you want APT to manage for you. The base zsh package comes from Ubuntu’s main repository, while optional plugin and font packages come from Ubuntu’s Universe component.

MethodSourceWhat It AddsBest Fit
Basic ZshUbuntu main repositoryThe core Z Shell packageUsers who want a faster interactive shell without extra plugins
Zsh with APT pluginsUbuntu Universe repositoryzsh-autosuggestions and zsh-syntax-highlightingUsers who prefer system-managed plugin updates
Zsh with Oh My ZshOh My Zsh GitHub projectHome-directory framework with hundreds of plugins and themesUsers who want extensive prompt, theme, and plugin customization

These steps cover Ubuntu 26.04 LTS, 24.04 LTS, and 22.04 LTS. Minimal or customized systems that cannot find the optional plugin packages may need to enable Universe and Multiverse repositories on Ubuntu before installing those extras.

For package-version checks, Ubuntu 26.04 and 24.04 install Zsh 5.9 from APT, while Ubuntu 22.04 stays on Zsh 5.8.1 for LTS stability. Use the Ubuntu package version as the expected output for this guide; manually compiled Zsh builds are outside this article’s scope.

Install Zsh on Ubuntu

Refresh the package index, then install Zsh from Ubuntu’s default repositories:

sudo apt update
sudo apt install zsh

These commands require sudo access. If your account cannot use sudo, add the account to sudoers on Ubuntu before continuing, then rerun the install command.

Verify the installed shell version:

zsh --version

Expected output on Ubuntu 26.04 and 24.04:

zsh 5.9 (x86_64-ubuntu-linux-gnu)

Ubuntu 22.04 returns the older LTS package:

zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

Run the Initial Zsh Configuration Wizard

The first time you start Zsh without a ~/.zshrc file, it opens an interactive configuration wizard. If you already have ~/.zshrc, Zsh skips the wizard and starts the shell prompt directly.

Start Zsh manually to trigger the wizard:

zsh

The wizard offers several startup choices:

  • Press q: Exit without creating a configuration file. The wizard appears again the next time Zsh starts.
  • Press 0: Create an empty ~/.zshrc file. Choose this if you want complete control or plan to let Oh My Zsh provide its own template.
  • Press 1: Open the main menu to configure history, completion, key bindings, and other settings interactively.
  • Press 2: Create ~/.zshrc with recommended defaults. This is the quickest standalone Zsh setup.

If you plan to install Oh My Zsh, any wizard option works because the installer can back up and replace an existing ~/.zshrc. For a standalone Zsh setup, option 2 provides practical defaults for history and completion.

Set Zsh as the Default Shell on Ubuntu

Ubuntu keeps Bash as the default login shell until you change it. First, confirm the Zsh path that chsh should use:

command -v zsh

Expected output:

/usr/bin/zsh

Set Zsh as your login shell:

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

Enter your password when prompted. The change applies after you log out and back in, but you can verify the configured login shell immediately:

getent passwd "$USER" | cut -d: -f7

Expected output:

/usr/bin/zsh

To start using Zsh in the current terminal before your next login, run:

zsh

Move Bash Aliases and Scripts to Zsh

Changing your login shell does not rewrite existing shell scripts. Scripts that start with a Bash shebang such as #!/bin/bash still run under Bash, even when your interactive terminal opens Zsh.

Aliases and functions are different because Zsh does not read ~/.bashrc by default. Copy the aliases you still need into ~/.zshrc, or source a separate aliases file from your Zsh configuration:

if [ -f ~/.bash_aliases ]; then
  source ~/.bash_aliases
fi

Zsh also stores command history in ~/.zsh_history, not ~/.bash_history. Keep the histories separate unless you intentionally migrate selected commands into your new Zsh history file.

Install Zsh Plugins with APT

Ubuntu packages two popular Zsh plugins in Universe. This path keeps plugin updates inside normal APT maintenance and avoids manual Git clones:

sudo apt install zsh-autosuggestions zsh-syntax-highlighting

Ubuntu 26.04 currently packages zsh-autosuggestions 0.7.1 and zsh-syntax-highlighting 0.8.0. Ubuntu 24.04 and 22.04 package zsh-autosuggestions 0.7.0 and zsh-syntax-highlighting 0.7.1. Use this method when stable distro-managed updates matter more than tracking each plugin’s upstream Git branch.

APT installs these plugin files under /usr/share/. Create ~/.zshrc if needed, then source the plugin files from the end of the file. The guards prevent duplicate entries if you rerun the commands later:

touch ~/.zshrc
grep -qxF 'source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh' ~/.zshrc || echo 'source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh' >> ~/.zshrc
grep -qxF 'source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' ~/.zshrc || echo 'source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' >> ~/.zshrc

Apply the updated configuration in the current terminal:

source ~/.zshrc

How the Zsh Plugins Work

Auto-suggestions display commands from your history as faded text while you type. Press the right arrow key or End to accept the full suggestion, or press Ctrl+Right Arrow to accept one word at a time.

Syntax highlighting colors your command line in real time. Valid commands appear differently from unknown commands, and file paths change color based on whether the path exists.

Install Oh My Zsh on Ubuntu

Oh My Zsh is a community framework for managing Zsh themes, plugins, helpers, and prompt behavior from your home directory. It is optional; the base Zsh install works without it.

Install Oh My Zsh Prerequisites

Install Git and curl before running the upstream installer. Git downloads the framework and custom plugin repositories, while curl retrieves the installer script:

sudo apt install git curl

For a deeper Git setup after the shell change, use the same-distro guide to install Git on Ubuntu.

Run the Oh My Zsh Installer

Run the current Oh My Zsh installer from the upstream script. The curl -fsSL flags make curl fail on HTTP errors, keep output quiet except for errors, and follow redirects:

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

The script backs up an existing ~/.zshrc to ~/.zshrc.pre-oh-my-zsh unless you tell it to keep the current file. If it asks to change your default shell, enter y only if you skipped the earlier chsh step.

If raw.githubusercontent.com is blocked on your network, use the official short installer endpoint instead:

sh -c "$(curl -fsSL https://install.ohmyz.sh)"

Relevant output includes:

Looking for an existing zsh config...
Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh
Using the Oh My Zsh template file and adding it to ~/.zshrc.

Oh My Zsh is now installed!
Run zsh to try it out.

Enable Oh My Zsh Plugins

Oh My Zsh manages plugins through the plugins array in ~/.zshrc. Clone the auto-suggestions and syntax highlighting plugins into the Oh My Zsh custom plugin directory:

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

Use either the APT plugin source lines or the Oh My Zsh custom plugin clones for the same plugin, not both. Loading duplicate auto-suggestion or syntax-highlighting scripts can slow startup or create confusing prompt behavior.

Open the Oh My Zsh configuration file:

nano ~/.zshrc

Find the line starting with plugins=( and add the new plugins:

plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

Save the file, then reload the configuration:

source ~/.zshrc

Additional plugin names and usage notes are available in the Oh My Zsh plugin directory.

Change the Oh My Zsh Theme

Oh My Zsh ships with many bundled themes, and the project maintains a separate theme gallery. To change themes, edit ~/.zshrc and change the ZSH_THEME value:

ZSH_THEME="agnoster"

The agnoster and powerlevel10k themes need Powerline-compatible fonts for arrows and prompt symbols to render correctly:

sudo apt install fonts-powerline

Restart your terminal after installing the fonts, then reload Zsh:

source ~/.zshrc

Troubleshoot Zsh on Ubuntu

Oh My Zsh Says Zsh Is Not Installed

The Oh My Zsh installer stops when it cannot find the zsh command:

Zsh is not installed. Please install zsh first.

Check whether Zsh is in your command path:

command -v zsh

If the command prints no path, install Zsh and rerun the Oh My Zsh installer:

sudo apt update
sudo apt install zsh

Default Shell Does Not Change

If your account still opens Bash after you changed the login shell, confirm that /usr/bin/zsh appears in the authorized shells file:

grep -x /usr/bin/zsh /etc/shells

Expected output:

/usr/bin/zsh

If the file is missing that path, add the path with sudo tee. The pipe sends the command output to a root-owned file because normal shell redirection would run as your unprivileged user:

command -v zsh | sudo tee -a /etc/shells

Run chsh -s "$(command -v zsh)" again and log out completely. Opening a new terminal window is not always enough because the login shell value is read during login.

Zsh Starts Slowly

If Zsh takes several seconds to start, profile the interactive startup path:

time zsh -i -c exit

Network calls, too many plugins, or heavy prompt themes usually cause slow startup. Temporarily move ~/.zshrc, test again, then restore it. The conditional keeps the check harmless when the file is missing:

if [ -f ~/.zshrc ]; then
    mv ~/.zshrc ~/.zshrc.bak
    time zsh -i -c exit
    mv ~/.zshrc.bak ~/.zshrc
fi

If startup improves with the file moved aside, re-enable sections of ~/.zshrc gradually until you find the slow command or plugin.

Prompt Symbols Display as Boxes

If your prompt shows boxes or question marks instead of arrows, Git symbols, or branch separators, install Powerline fonts:

sudo apt install fonts-powerline

Restart the terminal emulator after installation so it can load the new font files.

Zsh Plugins Do Not Load

For Oh My Zsh plugins installed with Git, confirm the plugin directories exist:

ls ~/.oh-my-zsh/custom/plugins/

Expected entries include:

zsh-autosuggestions  zsh-syntax-highlighting

Also confirm the plugin names in ~/.zshrc match the directory names exactly:

grep "^plugins=" ~/.zshrc

For APT-installed plugins, verify the packaged source files exist:

ls /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
ls /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

If those files exist but the plugins still do not work, place the source lines near the end of ~/.zshrc, after other prompt and plugin configuration.

Update Zsh on Ubuntu

Zsh and APT-installed plugins update through the normal Ubuntu package manager. To upgrade only already-installed Zsh packages, use --only-upgrade:

sudo apt update
sudo apt install --only-upgrade zsh zsh-autosuggestions zsh-syntax-highlighting fonts-powerline

Update Oh My Zsh

Oh My Zsh includes a built-in updater that pulls the latest framework changes from GitHub:

omz update

Update custom plugins installed with Git from their own directories:

git -C ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions pull
git -C ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting pull

Reload the Zsh configuration after updating plugins:

source ~/.zshrc

Remove Zsh from Ubuntu

Switch back to Bash before removing Zsh, then remove the packages and optional home-directory configuration.

Restore Bash as the Login Shell

Change your login shell back to Bash before uninstalling the Zsh package:

chsh -s /bin/bash

Verify the configured login shell:

getent passwd "$USER" | cut -d: -f7

Expected output:

/bin/bash

Uninstall Zsh Packages

Remove the base shell, APT plugins, and optional Powerline fonts if you installed them during the Zsh setup:

sudo apt remove --purge zsh zsh-autosuggestions zsh-syntax-highlighting fonts-powerline

After the package removal, review any autoremovable package list before confirming cleanup. Skip the command if APT proposes unrelated desktop packages, kernels, or tools you still need:

sudo apt autoremove

Remove Zsh Configuration Files

The following commands permanently delete your Zsh configuration, command history, and Oh My Zsh installation. Back up ~/.zshrc first if it contains aliases, functions, or prompt settings you want to reuse.

rm -rf ~/.oh-my-zsh ~/.zcompdump*
rm -f ~/.zshrc ~/.zshrc.pre-oh-my-zsh ~/.zsh_history

Log out and back in to finish the shell change. New terminal sessions should open Bash again after the next login.

Conclusion

With Zsh installed on Ubuntu, your login shell can use smarter completion, a cleaner prompt, and either APT-managed plugins or the larger Oh My Zsh ecosystem. Keep plugin choices in one path, review Install Git on Ubuntu if you plan to manage custom plugin repositories, and use curl command examples for Linux when troubleshooting installer downloads.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Verify before posting: