How to Install and Setup Zsh (Z Shell) in Fedora

The command-line interface is a powerful tool for interacting with your Linux system to perform various tasks efficiently. The default shell in many Linux distributions, including Fedora, is Bash (Bourne Again Shell).

There are alternative Linux shells that offer enhanced features, improved customization, and a more user-friendly experience. One such shell is Zsh, also known as the Z Shell.

What is Zsh?

Zsh (short for Z Shell) is a feature-rich and powerful shell program for Unix-like operating systems with lots of interactive features. It is an extended version of the Bourne Shell (sh), with a large number of new features, and support for plugins and themes. It is designed for interactive use and it is also a powerful scripting language.

One advantage of Zsh over most other Linux shell programs is that it is more sophisticated and configurable, yet super easy to customize.

Some of its key features include auto-completion with the cd command, recursive path expansion and spelling correction, and interactive selection of files and directories.

In this article, we will walk you through the process of installing and setting up Zsh in the Fedora system.

Installing Zsh in Fedora System

Zsh can be found in the Fedora repositories and can be installed using the following dnf command.

$ sudo dnf install zsh

To start using it, simply run zsh and the new shell prompts you with an initial configuration function wizard for new users as shown in the screenshot below.

This wizard allows you to create Zsh’s startup/initialization files. Press (1) to continue to the main menu.

$ zsh
Running Zsh in Fedora
Running Zsh in Fedora

Here is an image showing the main menu. Note that the status of all configurable options is Recommended. To pick an option for configuration, enter the key for the option.

Zsh Configuration Options
Zsh Configuration Options

For example, enter (1) to select configure settings for history. From the next screen, enter (0) to remember edit and return to the main menu (where the status of this option should change to Unsaved changes).

Select Zsh Configuration Options
Select Zsh Configuration Options

Repeat the previous two steps for the other options. Now the first three options should indicate a status of Unsaved changes. Configuration option (4) allows you to pick some common shell options.

Zsh Shell Option
Zsh Shell Option

To save the new settings, enter (0). You will see the message shown in the following screenshot and your command prompt should change from $(for Bash) to %(for Zsh).

Zsh Command Prompt
Zsh Command Prompt

Now that you have set up Zsh on your Fedora system, you can go on and test some of its key features, as we mentioned at the beginning of this article. These include auto-completion, spelling correction, and much more.

Making Zsh as Default Shell in Fedora

To make Zsh your default shell, so it executes whenever you start a session or open a terminal, issue the chsh command, which is used to change a user’s login shell as follows (you’ll be prompted to enter your account password).

$ grep tecmint /etc/passwd
$ chsh -s $(which zsh)
$ grep tecmint /etc/passwd
Set Zsh Default Shell in Fedora
Set Zsh Default Shell in Fedora

The above command informs your system that you want to set (-s) your default shell (which zsh).

Install Oh-My-Zsh in Fedora

Zsh’s real power lies in its configurability, which can be achieved by customizing various aspects of your Zsh environment, such as themes, plugins, and aliases. One popular framework for managing Zsh configuration is Oh-My-Zsh, which provides a collection of useful plugins and themes.

$ sh -c "$(curl -fsSL"

Once the installation is complete, your Zsh configuration will be automatically updated to use Oh-My-Zsh.

Install Oh My Zsh in Fedora
Install Oh My Zsh in Fedora

Choosing an Oh-My-Zsh Theme for Fedora

Oh-My-Zsh offers a variety of themes that you can use to change the appearance of your terminal. You can browse available themes in the ~/.oh-my-zsh/themes/ directory.

$ ls ~/.oh-my-zsh/themes/
List Oh-My-Zsh Themes
List Oh-My-Zsh Themes

To change the theme, open your ~/.zshrc file in a text editor and locate the line that sets the ZSH_THEME variable.

$ sudo nano ~/.zshrc

and change the value to the name of the theme you want to use.

Set Oh-My-Zsh Theme
Set Oh-My-Zsh Theme

Save the file and restart your terminal to see the new theme in action.

Adding an Oh-My-Zsh Plugin for Fedora

Oh-My-Zsh supports a wide range of plugins that you can use to enhance Zsh’s functionality. You can enable plugins by editing your ~/.zshrc file and adding the plugin names to the plugins array.

For example, to enable the git and docker plugins, your configuration would look like this:

plugins=(git docker)
Add Oh-My-Zsh Plugin
Add Oh-My-Zsh Plugin

After adding or modifying plugins, save the file and restart your terminal.

For more usage instructions, see the zsh man page.

$ man zsh

Zsh an extended version of the Bourne Shell (sh), with a large number of new features, and support for plugins and themes. If you have any comments or questions, reach us via the feedback form below.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.


Leave a Reply
  1. That $(which zsh) part was actually very clever.

    Dunno why I never thought of that before.

    I’m equally mind blown as the day I found out you can use $nproc in make. :D


Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.