loading...

Installing and customizing oh-my-zsh on Ubuntu

nicoh profile image Nico H. ・2 min read

ZSH (or Z Shell), is an extended version of the default shell. It includes new features, themes and plugins.

We can install it from the default shell using:

$ apt install zsh

Oh-my-zsh is a framework that runs on top of ZSH. If you want to understand it from a web example, it would be something like this: ZSH is Javascript and oh-my-zsh is React/Angular/Vue/etc.

From their site:

Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration. It comes bundled with thousands of helpful functions, helpers, plugins, themes, and a few things (...)

We can simply install it with a one-liner. Via cURL:

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

Or via Wget:

$ sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

We accept changing our default shell to zsh, enter our password and that's it:

installation_completed

Note: As you can see, the ~ symbol indicates that zsh is being used. But if we close the terminal and open it again, the default shell will be used.

We can now run '$ zsh' to enable it, or simply logout/login and the default shell will be zsh.

If the change didn't work and we still have the default shell running, run:

$sudo chsh -s $(which zsh) $(whoami)

Customization

ohmyzsh comes with a lot of plugins and themes preinstalled. I'll be showing you how to customize it using my current preset.

First, we install powerline font to have support for icons in our terminal:

sudo apt install fonts-powerline

Then, we change the default theme 'robbyrussell' to agnoster. This one is pretty common because it's optimized for git repository usage.

sudo nano ~/.zshrc

And change ZSH_THEME variable to ZSH_THEME="agnoster".

To remove the username and host from the prompt, modify:

sudo nano ~/.oh-my-zsh/themes/agnoster.zsh-theme

And comment 'prompt_context' like below:

comment_prompt_context

If you followed the previous steps, you'd have something like this (using Solarized Dark theme for the terminal):

final

Posted on by:

nicoh profile

Nico H.

@nicoh

👨🏻‍💻 Tech enthusiast. Web, JS, React. Game Developer. Traveler 🧳 [EN/ES] Twitter: @n_hevia Github: nhevia Open for freelance/remote work

Discussion

pic
Editor guide
 

I highly suggest Antibody over Oh My Zsh. With Oh My Zsh adding any more than 3 plugins can make your shell take up to 10 seconds or more to load.

Antibody is a plug-in manager written in Go so that it loads the plugins simultaneously instead of one at a time and is significantly faster.

 

Hi Ethan, thanks for your suggestion. Have you tried using Antibody to load oh-my-zsh plugins in the past?

 

Precise and to the point. Thank you.

 

I ♥️ zsh! I'm use um Fedora!