This article is transcoded by SimpRead, original address www.poloxue.com
This tutorial mainly introduces the installation of zsh, themes, and 7 efficiency-boosting zsh plugins

Previously, we had a basic understanding of iTerm2. But an efficient terminal environment needs an excellent shell interpreter.
Video version, less detailed than the article:
This article mainly introduces the installation of zsh + oh-my-zsh, prompt theme configuration, and 7 efficiency-boosting zsh plugins.
Why use zsh?
Before starting, it’s a good habit to ask why, to know not only what but also why.
So, why use zsh?
The shell interpreter most people are familiar with is definitely bash. What advantages does zsh (Z Shell) have compared to bash (Bourne Again Shell)?
Improved auto-completion capabilities
zsh provides more powerful and flexible auto-completion features. It can not only auto-complete commands but also options, parameters, and even file names.

For command parameters, zsh can even display brief help information, making it easier to explore new commands.
Better script and plugin support
zsh has a strong community that offers a large number of plugins and themes, such as oh-my-zsh, a popular zsh framework that allows us to easily add and update plugins and themes.

These plugins can enhance shell functionality by providing convenient aliases, functions, and other useful features.
Advanced theme and prompt customization
zsh also allows users to highly customize the command line prompt, including colors, content, and format. Users can easily adjust the prompt to display git branches, Python virtual environments, and more.

Later, we will introduce a very powerful zsh plugin called powerlevel10k, which supports complete theme customization and is extremely powerful.
Smarter command line interaction
zsh supports some intelligent features not available in bash, such as spelling correction and approximate completion. If a command is misspelled, zsh can suggest the correct command.
For example, if I type lls, it prompts: “zsh: correct ’lls’ to ’ls’ [nyae]?”
Pressing y accepts the correction suggestion.
Of course, this requires simple configuration by enabling setopt CORRECT_ALL.
Others
There are many other powerful features. For example:
zsh’s command history is shared across terminals. Through auto-completion, it greatly enhances operational efficiency and experience.
zsh’s file matching and wildcard features are indeed much more powerful than Bash’s. Besides the regular wildcard capabilities, it also offers extended wildcards, qualifiers, such as recursive matching **/, where ls **/*.go will list all Go files. !{pattern} matches content that does not fit the pattern. More can be explored on your own.
zsh is more configurable, providing more options and features than bash, all adjustable through configuration files.
If you want to dive deeper into zsh, I recommend the awesome-zsh-plugins repository. Or you can check out an in-depth series of articles about zsh:
- Configuring Zsh Without Dependencies
- A Guide to Zsh Expansion with Examples
- A Guide to the Zsh Completion with Examples
- A Guide to the Zsh Line Editor with Examples
Alright, the preface is a bit long. This article focuses on practical use, so the comparison part will be left at this.
Installation
The installation commands for different systems are as follows:
Debian
Centos
Arch Linux
Fedora
For macOS users, the default shell has been switched to zsh since 2019, so this step can be skipped. You can read: What is Zsh? Should You Use it? which explains why macOS switched its default shell from bash to zsh in 2019.
From what I’ve seen, the main reason is copyright issues.
If you’re still using an older macOS system before 2019, you can install it using:
After installation, set zsh as the default shell with the following command:
Check if it was successful by running the command:
oh-my-zsh
oh-my-zsh is a lightweight framework for managing zsh configurations, featuring out-of-the-box usability and many built-in plugins. Let’s use it to quickly configure zsh!
The name oh-my-zsh is quite flashy, roughly like the following emoji.

It probably expresses that when others see your terminal configured with oh-my-zsh, they’re likely to say “wow! Your terminal is awesome!”
OK, now let’s try to make it awesome.
Installation
First, the installation of oh-my-zsh is very simple.
The installation command is as follows:
❯ lls
zsh: correct 'lls' to 'ls' [nyae]?
After installation, there are already some default effects, such as theme changes in the command line prompt.

This is the default oh-my-zsh theme “robbyrussell”.
Themes
oh-my-zsh provides many built-in themes; you can check themes for a list of themes.
We can update the theme configuration by editing the ~/.zshrc file, modifying the content as follows:
Run source ~/.zshrc to apply the configuration and see the theme effect.

Additionally, oh-my-zsh provides a random theme option that randomly selects a theme from the built-in themes each time. Simply edit ~/.zshrc to set ZSH_THEME to random.
The configuration is as follows:
The demo effect is like this:

Honestly, I don’t think many people would use this. It’s quite a useless feature.
Built-in Plugins
Here comes the important part — let’s take a look at zsh’s efficiency booster: plugins.
I recommend 7 commonly used plugins, among which 5 are oh-my-zsh built-in plugins. Considering length, I will recommend 6 more plugins in the next issue.
All oh-my-zsh built-in plugins can be found in the repository ohmyzsh/ohmyzsh/plugins, each with associated documentation.
The 5 oh-my-zsh built-in plugins covered in this tutorial are as follows:
- git, Git plugin, which basically provides some common git command aliases.
- web-search, open search engines directly from the command line, supporting most search engines;
- jsontools, for formatting JSON data;
- z, fast directory jump based on history;
- vi-mode, use vi-mode for command line editing;
To enable all plugins, open the zshrc configuration file and enable these built-in plugins as shown:
apt install zsh
Plugin 1 - git
The Git plugin provides many git command aliases. See the git plugin documentation.
Here are some common command aliases:
More mappings can be found in their documentation.
This plugin is good but has a drawback: with so many aliases, I cannot remember them all, making them just decorations. If I want to use it well, do I have to look up the docs every time? Is it possible to not check the docs?
Of course it is. Some other plugins enabled in oh-my-zsh may also have aliases.
Actually, there is a plugin that helps with this called you-should-use, which will be introduced in the next issue. Briefly, its role is to remind us to use aliases if we type a command that has an alias.
Plugin 2 - web-search
web-search allows you to search information directly from the terminal.
Well, not completely in the terminal—it automatically switches to the browser and executes the search on the specified search engine.
The effect is roughly like this:

Common search engines are supported, such as Google, Bing, Baidu, even GitHub.
However, I admit I rarely use this plugin, since I have installed another tool called Alfred (which replaces macOS Spotlight), and I launch searches directly through that.
Plugin 3 - jsontools
The next plugin, called jsontools, is a JSON tool. It provides basic commands to operate on JSON, such as:
pp_jsonfor formatting JSON strings;is_jsonto check if text is JSON;
Let’s see a demo:

I must say, if you don’t have a better solution and have installed oh-my-zsh, this is a good choice because you might not have ever used such tools before.
However, I rarely use this plugin myself.

I’m accustomed to using a command called jq, which is very powerful. I’ll mention it when talking about efficient commands later.
Plugin 4 - z
The z plugin is used for fast directory jumping. I think most Linux users have been annoyed by cd jumping between directories.
z is the savior for that frustration.
For more info, check the original z repository - zsh-z. The oh-my-zsh z plugin documentation mentions it is copied from that zsh-z plugin.
Let me introduce how to use it. Simply put, it allows rapid directory jumping based on your directory history. You don’t need to type the full path to switch.
Here are some practical examples.
First, I type z and press Tab, showing this effect. It lists all previously visited directories.

These tab-generated auto-completion directories are directories visited before. Because when we press Tab without typing anything, it lists recently visited directories.
If we type z substring, providing a substring, it lists all directories matching that substring.
Here is the effect:
For example, type z blog and press Tab, and it will directly list directories containing “blog” that have been visited.

If there is only one matching directory, as shown, it will auto-complete immediately.
Demo:
Type z tmux; since only one directory matches tmux, it will be directly selected.

Also, if only one directory matches, you can simply press Enter to jump without multiple Tab presses.
Demo:
Type z tmux and press Enter directly to jump to the directory.

z is very powerful, right?
Actually, there is a more powerful command called zoxide that provides similar capabilities and was inspired by z. I usually use it; I will introduce it later.
Of course, that doesn’t stop you from continuing to use the oh-my-zsh built-in tool z, which is easy to configure.
Plugin 5 - vi-mode
The vi-mode plugin enables vi mode for the command line, allowing command editing using vi-style keys.
Whether to use this plugin depends on the individual. If you are a vi enthusiast, consider enabling it. Otherwise, simplicity is best; otherwise it may affect your mood.
I won’t elaborate much on this plugin; more info can be found in its documentation. Also, if you are really interested in vim, you can consider another vi plugin called zsh-vi-mode with more powerful features and some bug fixes for the default vi-mode, though it’s a bit more complex to configure.
Third-Party Plugins
Let’s also look at 2 non oh-my-zsh built-in plugins: zsh-syntax-highlighting and zsh-autosuggestions. These two are developed by the zsh community.
Before starting, install and configure these two plugins.
Download
Download commands are as below:
yum install -y zsh
Configuration
Open .zshrc to complete configuration:
Remember to run source ~/.zshrc to apply the changes.
Plugin 6 - zsh-syntax-highlighting
zsh-syntax-highlighting is a syntax highlighting plugin for zsh that highlights invalid commands or incorrect shell syntax in red. Its advantage is to provide real-time feedback while typing in the terminal.
First, try an incorrect command to see the prompt effect, as shown:

Now let’s see the prompt effect with a correct command:

Exactly, it’s that simple. This plugin’s real-time feedback helps prevent discovering typing errors only after command execution.
Plugin 7 - zsh-autosuggestions
zsh-autosuggestions is probably my favorite plugin.

What does it do?
It provides suggestion completions as you type characters. By default, it automatically suggests input based on your command history. Remember I mentioned zsh’s command history is shared across sessions? Together with zsh-autosuggestions, it’s fantastic!
Let’s see the effect:

By default, pressing the right arrow key → inputs the suggestion directly into the terminal.
But this experience is poor for someone who wants to keep both hands centered on the keyboard. Accepting suggestions with the right arrow is annoying. Can we change this default key shortcut?
My goal is to accept suggestions by pressing Ctrl + /. The configuration to achieve this is as follows:
pacman -S zsh
Yes! Don’t doubt it. The character for CTRL+/ is ^_. You can verify it by running the cat command and pressing CTRL+/, output like this:

If you don’t know the character representation of the shortcut you want to set, you can find it this way.
Additionally, if you want zsh-autosuggestions to suggest not only from history but also from tab completion (such as subcommands, options, directory and file suggestions), just add the completion option.
It is as follows:Now, if there are no historical commands available as suggestions during input, suggestions such as directories and parameter options will be provided.
Similar to the effect below:

This is an article with a high amount of GIF content.
Summary
The content intended to be introduced in this article has been completed. We began by comparing zsh and bash, learning about the powerful features of zsh. Then we started hands-on practice, from installing zsh, oh-my-zsh, and theme configuration, to introducing 5 built-in plugins and 2 third-party plugins.
Finally, I hope this article can help improve your terminal operation efficiency even a little, and I will be satisfied.
My blog post: My Terminal Environment: zsh, oh-my-zsh, prompt themes, and 7 efficiency plugins