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:
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:
If you followed the previous steps, you'd have something like this (using Solarized Dark theme for the terminal):
Top comments (7)
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?
I followed all the instructions. I have weird question mark icons on my prompt. I'm using it on a headless Ubuntu 20.04 LTS server on a Raspberry Pi 4.
Totally looks like a powerline font issue. If you already followed that step, you might be having an issue with it not being used. You might want to check this
Ok I solved the problem with installing a font optimized for Powerline here then changed my terminal font.
Precise and to the point. Thank you.
I ♥️ zsh! I'm use um Fedora!