zsh (Z Shell) is a very popular Unix shell. It’s similar to Bash but comes with many added features that change its appearance and behavior.
zsh is also very customizable, which allows users to create their own themes and plugins, which further extends its features.
What is Oh My Zsh
Oh My Zsh is a framework that makes it easy to apply customizations, such as themes and plugins, to
zsh. It comes preinstalled with over 150 themes and over 300 plugins that can be easily enabled with a single command.
Because of the growing number of customizations made for
zsh by many enthusiastic users from around the world, it can be difficult to find and manage all of these custom extensions.
Oh My Zsh is very easy to install and works out of the box, which sets you up with a great foundation for customizing
There are other features that you can add that don’t come preinstalled with Oh My Zsh, however it is a straightforward process to install those features as well.
In this tutorial we’ll explain what Oh My Zsh is, how to install it and how to use it to manage
zsh extensions. We’ll explore some of the commands it comes with, how to change themes and plugins, and how to add a custom plugins, such as the popular zsh-autosuggestions plugin.
The rest of this tutorial assumes that you have
zsh installed and set as the default shell on your system. If you don’t have
zsh installed, you can follow our related article on installing zsh on Linux and return once you’re finished with the initial configuration.
Table of Contents
Installing Oh My Zsh
Installing Oh My Zsh is very straightforward. With
zsh installed we just need to download and run the install script and wait for it to finish. You should notice changes in your shell’s theme immediately.
Install curl/wget & git
To download the script we’ll need to have either
wget installed, and to run the script we’ll need the
git package installed.
To keep things simple we’ll demonstrate how to install all three, since most users may have both
We’ll just mention how to install these packages on Debian-based and RHEL-based distros, since they are among the most used, and installing these packages should be a straightforward process on most distros.
Install curl, wget, and git on Ubuntu/Debian/Linux Mint, and other Debian-based distros, using the
apt package manager:
sudo apt install curl wget git
Install curl, wget, and git on CentOS/Fedora/Rocky Linux/AlmaLinux, and other RHEL-based distros, using the
dnf package manager:
sudo dnf install curl wget git
To install Oh My Zsh just run one of the following commands, depending on whether you have
wget installed. Both will have the same result.
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
When it finishes installing you should see the following screen, with the theme of your shell changed.
The Oh My Zsh install script also backs up your
.zshrc file (used for configuring the interactive shell), so you can restore your previous configurations if you decide to uninstall Oh My Zsh.
We can check this by running the following command in the home directory:
ls -la | grep zshrc
-rw-r--r-- 1 edxd edxd 3871 Dec 17 11:18 .zshrc -rw-rw-r-- 1 edxd edxd 316 Dec 16 12:16 .zshrc.pre-oh-my-zsh
The backup is called
Using Oh My Zsh
Oh My Zsh comes with a command line interface to make it easier to use and configure.
If you just run
omz in your command-line you’ll see all the options it offers:
Usage: omz <command> [options] Available commands: help Print this help message changelog Print the changelog plugin <command> Manage plugins pr <command> Manage Oh My Zsh Pull Requests reload Reload the current zsh session theme <command> Manage themes update Update Oh My Zsh version Show the version
For some configurations we can just use the
omz command, instead of having to edit the
Oh My Zsh also provides a few useful resources on their Github Wiki:
– Cheatsheet – useful basic commands
– FAQ – definitions, how to’s, and how to fix some common problems.
– Troubleshooting – most common problems and how to diagose them
– Customization – information on how to customize Oh My Zsh according to your needs
– Resources – various useful resources for using Zsh and Oh My Zsh
Change Themes with Oh My Zsh
You can change themes using the
omz command or directly editing and reloading the
We’ll look at how to change themes using the
If you run just the
omz theme command you’ll be shown a few useful instructions on how to
list all available themes,
set and use a new theme or
use a new theme temporarily.
Usage: omz theme <command> [options] Available commands: list List all available Oh My Zsh themes set Set a theme in your .zshrc file use Load a theme
The default theme for Oh My Zsh is
To list all available themes, and also see your current theme, run the following command:
omz theme list
Current theme: robbyrussell Custom themes: example Built-in themes: 3den adben af-magic afowler agnoster alanpeabody amuse apple arrow ...
To change your theme you can use the
set command. For example, to change your theme to
omz theme set af-magic
omz::theme::set: 'af-magic' theme set correctly.
The changes should be applied and your theme will be
af-magic every time you open a new session.
To change your theme for just this session you can use the
omz theme use af-magic
Your theme will be changed only in this session and next time you open a new terminal window you’ll still use your previous theme.
Manage Plugins with Oh My Zsh
Oh My Zsh comes with over 300 plugins preinstalled.
You can check the
omz commands available to manage plugins by running:
Usage: omz plugin <command> [options] Available commands: disable Disable plugin(s) enable Enable plugin(s) info Get information of a plugin list List all available Oh My Zsh plugins load Load plugin(s)
You can easily list preinstalled commands by running the following command:
omz plugin list
You can also view the plugins on Github.
To view info on a plugin in the command line you can use the
info command. The following command will show the information for the
omz plugin info web-search
# web-search plugin This plugin adds aliases for searching with Google, Wiki, Bing, YouTube and other popular services. Open your `~/.zshrc` file and enable the `web-search` plugin: ```zsh plugins=( ... web-search) ``` ## Usage You can use the `web-search` plugin in these two forms: * `web_search <context> <term> [more terms if you want]` * `<context> <term> [more terms if you want]` For example, these two are equivalent: ```zsh $ web_search google oh-my-zsh $ google oh-my-zsh :
The info is displayed in the
vim editor. You can use the
down arrow to scroll, and press
q to exit the information screen.
To enable a preinstalled plugin you can use the
enable command. The following command will enable the
omz plugin enable web-search
omz::plugin::enable: plugins enabled: web-search.
Now the functionality of the plugin is added, and when I run the following command in my command-line, my default browser will open a new tab and search for my chosen term using my chosen search engine.
The following command will open a new tab in my default browser and search Google for bytexd:
web_search google bytexd
Install Custom Plugins
There are many other very Zsh popular plugins that don’t come preinstalled with Oh My Zsh.
However Oh My Zsh makes it easy to install custom external plugins.
Standard plugins (the preinstalled ones) are stored in
Custom plugins may be added to
To install a new plugin all we have to do is download it and correctly move it into it’s own directory in
~/.oh-my-zsh/custom/plugins and then add it to the list of plugins in the
~/.zshrc file. We can add it to the
~/.zshrc file manually or just by using the
omz plugin enable command.
For example we will install a very popular plugin called zsh-autosuggestions. This plugin elegantly displays unobtrusive autocomplete suggestions in a muted gray color as you type.
To install it we need to download it the correct directory. In our case we will download it from Github by cloning it with the
The following command will download the
zsh-autosuggestions plugin into the
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
Cloning into '/home/edxd/.oh-my-zsh/custom/plugins/zsh-autosuggestions'... remote: Enumerating objects: 2435, done. remote: Counting objects: 100% (50/50), done. remote: Compressing objects: 100% (42/42), done. remote: Total 2435 (delta 21), reused 21 (delta 7), pack-reused 2385 Receiving objects: 100% (2435/2435), 566.38 KiB | 4.16 MiB/s, done. Resolving deltas: 100% (1552/1552), done.
Lastly we can enable it with the
omz plugin enable zsh-autosuggestions
omz::plugin::enable: plugins enabled: zsh-autosuggestions.
Now, when you type you’ll see subtle autocomplete suggestions based on your command history:
You can also enable plugins by directly editing the
~/.zshrc file manually.
Uninstall Oh My Zsh
To remove Oh My Zsh you can run the following command:
It will remove all the necessary files and directories and will revert your
~/.zshrc to its previous state.
In this tutorial we explained how to install Oh My Zsh, the basics of using it, how to change themes and plugins, how to install custom plugins, and how to uninstall it.
If you encountered any issues or have any questions feel free to leave a comment and we’ll get back to you as soon as we can.