Install Oh My Zsh on Ubuntu

This tutorial will show how to install and configure Oh My Zsh in Ubuntu.

Oh My Zsh is a framework for managing Zsh configuration.

Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.

Oh My Zsh will not make you a 10x developer…but you may feel like one.

Once installed, your terminal shell will become the talk of the town or your money back!

Oh My Zsh GitHub repository

It will help you to add themes, plugins, etc. to ease your command line/terminal experience.

Install

Its installation is straight-forward. Steps are given below:

1. Install Zsh using below commend:

sudo apt install zsh

2. Check Zsh installation:

zsh --version

3. Make Zsh your default shell:

chsh -s $(which zsh)
# For Termux: chsh -s zsh

4. Logout and re-login to use the default shell.

Note: After login, if you prompt zsh-newuser-install, then just enter “0” and complete the installation.

(0) Exit, creating the file ~/.zshrc containing just a comment.

5. Check default shell:

echo $SHELL
# /usr/bin/zsh

6. Install Powerline fonts to render themes correctly:

sudo apt-get install fonts-powerline

7. Finally install Oh My Zsh using following commend:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Change Theme

A list of themes will be found here. To change the theme, just change the following variable from ~/.zshrc file:

ZSH_THEME="robbyrussell"

Replace robbyrussell with the theme name you want to activate.

Plugins

A list of plugins which come with the installation listed here. Just add the plugins name separated by space or new-line in the following variable in ~/.zshrc file:

plugins=(
  git
  colored-man-pages
  zsh-syntax-highlighting
  zsh-autosuggestions
)

Here, the last two plugins are not bundled with the default installation. You have to download or clone them from their repository to the ~/.oh-my-zsh/custom/plugins folder:

cd ~/.oh-my-zsh/custom/plugins
git clone git@github.com:zsh-users/zsh-syntax-highlighting.git
git clone git@github.com:zsh-users/zsh-autosuggestions.git

Other tweaks

To hide “username@localhost” from the default head text add the following code to the end of ~/.zshrc file:

# The "username" should be your system username.
DEFAULT_USER=username
prompt_context(){}

To get package suggestion for not installed packages, add the following code to the end of the ~/.zshrc file:

# If anything goes wrong install 'command-not-found' package.
source /etc/zsh_command_not_found

Bonus: Add the following lines to end of ~/.zshrc file, so that you can write something like “please apt update”. 🙂

# Use "please" as an alias of "sudo"
alias please=sudo

Enjoy!


Help Links:

One thought on “Install Oh My Zsh on Ubuntu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.