Install Oh-My-Zsh In Ubuntu, Arch Linux And Fedora

oh-my-zsh should work with any recent release of zsh, the minimum recommended version is 4.3.9.
First you need to install ZSH. If not installed just fire up your terminal and do now.

Oh-My-Zsh is an open source, community-driven framework for managing your ZSH configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes, and few things that make you shout… “OH MY ZSHELL!”.

ZSH_Terminator

Fig 1 above show oh-my-zsh running in Terminator

Install ZSH

oh-my-zsh should work with any recent release of zsh, the minimum recommended version is 4.3.9.

First you need to install ZSH. If not installed just fire up your terminal and do now.

Fedora:

sudo yum install zsh

Arch Linux/ Manjaro:

sudo pacman -S zsh

Ubuntu, Linux Mint, Debian:

sudo apt-get install zsh

Install Oh-My-Zsh

Automatic Installation

This can be done via `curl` or `wget`.

Open Terminal,

via `curl`:

curl -L http://install.ohmyz.sh | sh

via `wget`:

wget --no-check-certificate http://install.ohmyz.sh -O - | sh

Manual Installation

1. Clone the repository

git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

1.a. If you already have an existing ~/.zshrc file, create a backup:

cp ~/.zshrc ~/.zshrc.orig

3. Create a new zsh config by copying the zsh template we’ve provided.

cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

4. Set zsh as your default shell:

chsh -s /bin/zsh

5. Restart ZSH.

Also take a look the various themes and plugins to make your terminal look good.

Enjoy.

Common Issues Encountered When Installing Oh-My-Zsh

There’s a slight chance you might have trouble when installing Oh-My-Zsh. Here are two fixes that often solve installation issues:

  1. If you’re unable to find some commands when you begin using Oh-My-Zsh, modifying the PATH variable in ~/.zshrc should make it work correctly.
  2. If you moved the installation folder or installed your tool manually, you might need to change the ZSH variable in ~/.zshrc.

Custom Themes and Plugins

If you want to make changes to your copy of Oh-My-Zsh and override its default behaviors, you must add a new file to the custom/ directory. As you’d expect, the file must be in .zsh file format.

On one hand, if you want to use as many functions as possible, put them in a file and save it as XYZ.plugin.zsh file. You must put this file in the custom/plugins/ directory, and then you should be able to enable this plugin.

On the other hand, if you want to override a plugin’s functionality, make a plugin with the same name in the custom/plugins/ folder. Oh-My-Zsh will load your plugin instead of the one present in the plugins/ folder. 

Using GNU with Oh-My-Zsh on freeBSD and macOS

Oh-My-Zsh works with the BSD ls command on freeBSD and macOS by default. However, if you’ve installed GNU ls on your machine, you can set Oh-My-Zsh to use it instead. 

Making the switch to GNU involves setting up the zstyle-based config and then sourcing oh-my-zsh.sh, like so:

zstyle ‘:omz:lib:theme-and-appearance’ gnu-ls yes

 

Bear in mind setting DISABLE_LS_COLORS to true will not work.

How to Skip Default Aliases in Oh-My-Zsh

Skipping the default and plugin aliases requires yo u to modify the settings in a specific ~/.zshrc file. You will need to make the changes before Oh-My-Zsh loads on your machine. 

# Skip all plugin aliases

zstyle ‘:omz:plugins:*’ aliases no

# Skip only aliases defined in the directories.zsh lib file

zstyle ‘:omz:lib:directories’ aliases no

# Skip all aliases in lib files

zstyle ‘:omz:lib:*’ aliases no

# Skip all aliases, in lib files and enabled plugins

zstyle ‘:omz:*’ aliases no

# Skip only the aliases from the git plugin

zstyle ‘:omz:plugins:git’ aliases no

 

It’s important to note that there are many ways to skip aliases. You can take into account the scopes that take precedence and combine the files in a different way:

# Skip all plugin aliases, except for the git plugin

zstyle ‘:omz:plugins:*’ aliases no

zstyle ‘:omz:plugins:git’ aliases yes

 

The following setting was used in earlier versions of Oh-My-Zsh but has now been removed:

zstyle ‘:omz:directories’ aliases no

 

So, you can use this instead of the removed setting:

zstyle ‘:omz:lib:directories’ aliases no

 

Bear in mind that this feature is in the testing phase. The developers may change or remove it in future updates. 

Moreover, it doesn’t work with plugin managers like zinit and zpm, as they don’t source the init script (Oh-My-Zsh.sh) where the feature is implemented.

How to Use Oh-My-Zsh

Oh-My-Zsh boasts a huge assortment of plugins that you can find in the plugins directory. You can also check the dozens of available plugins in the official Oh-My-Zsh wiki.

Enabling Plugins 

After you find the plugins you’re interested in using, you can enable them from the .zshrc file. You can find the file in your $HOME directory. 

It’s easy to open the file with any text editor. You can open it by running:

vi ~/.zshrc

 

You’ll find a place to include the plugins you want Oh-My-Zsh to load. You can mention the plugin names under the “plugins=(“section, like so:

plugins=(

  ruby

  bundler

  git

  rbenv

  macos

  dotenv

  rake

)

 

As you can see, the plugins are clearly separated by whitespace. If you put any commas between the names, you can expect Oh-My-Zsh to break.

Bear in mind that every plugin comes with a README file, which includes the aliases of the plugin (if it is using any). Of course, you can also expect to find descriptions of the plugin’s features in this file.

Applying Themes

Oh-My-Zsh comes with over 150 themes bundled, allowing you to give it just the right look for your taste. You can find screenshots of most available themes on the tool’s official Wiki page. 

By default, Oh-My-Zsh uses Robby’s theme. It’s plain-looking but not the simplest to use. Once you pick a theme you like, you must modify the ~/.zshrc file to change to the theme. 

You will find the “ZSH_THEME” environment variable in the file and must change its value to the theme you want to use. This is what the variable looks like after installation: 

ZSH_THEME=”robbyrussell”

 

Let’s say you want to use a fancy theme. The Agnoster theme might feel right for you, and you will need to change the variable like this:

ZSH_THEME=”agnoster”

 

Bear in mind that several Oh-My-Zsh themes require the Nerd Font or Powerline Font to render correctly. If you haven’t installed these on your machine, you might see some irrelevant symbols appear in some themes.

Interestingly, the developers allow you to make a shortlist of themes for Oh-My-Zsh, and it will randomly apply one from your shortlist.

All you have to do is put the names of themes you’ve shortlisted under the following variable in the ~/.zshrc file:

ZSH_THEME_RANDOM_CANDIDATES=(

  “robbyrussell”

  “agnoster”

)

 

If you’re not interested in shortlisting themes but want to try them all out at random whenever you open a new terminal, you can add this line: 

ZSH_THEME=”random”

 

There’s a good chance that you won’t find a handful of themes too attractive. You can put these themes in a “blacklist” so they don’t appear. Just add this line:

ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod)

 

How to Keep Oh-My-Zsh Updated

Oh-My-Zsh will automatically remind you to check for an update every 14 days. However, you can choose other ways to update by adding some lines in the ~/.zshrc file. As mentioned earlier, you must modify this file before Oh-My-Zsh loads. 

To update Oh-My-Zsh automatically without a confirmation prompt, add this line:

zstyle ‘:omz:update’ mode auto

 

If you want to be reminded about available updates every few days, add this line:

zstyle ‘:omz:update’ mode reminder

 

You can also disable automatic updates completely and not update Oh-My-Zsh until you want to. Just add this line:

zstyle ‘:omz:update’ mode disabled

 

If it’s the frequency of update checks that bothers you, you can set the checking frequency by adding these lines:

# This will check for updates every 7 days

zstyle ‘:omz:update’ frequency 7

# This will check for updates every time you open the terminal (not recommended)

zstyle ‘:omz:update’ frequency 0

 

Interestingly, Oh-My-Zsh also allows you to alter the update verbosity with these settings:

zstyle ‘:omz:update’ verbose default # default update prompt

zstyle ‘:omz:update’ verbose minimal # only few lines

zstyle ‘:omz:update’ verbose silent # only errors

 

How to Uninstall Oh-My-Zsh

Though Oh-My-Zsh is a powerful tool, it might not be the best tool for everyone. You can run “uninstall_oh_my_zsh” on a terminal to remove it from your machine. 

Besides removing the tool, running this command will also revert you to the default zsh or bash configuration.

Source: OH-MY-ZSH