How to Customize Ubuntu Terminal Using Oh My Zsh

Have you ever used Powerline to customize your Terminal? With Oh My Zsh, you’ll not only upgrade your terminal but also enhance its interface in a more appealing and functional way.

This article provides 3 detailed steps to change the interface and customize your Terminal using Oh My Zsh:

Step 1. Install Oh My Zsh

Oh My Zsh is an open-source ZSH configuration management tool, widely developed by the community. It integrates many features, plugins, helpers, and hundreds of useful themes, helping you use the terminal effectively and enjoyably. Currently, Oh My Zsh supports over 275 plugins and over 150 diverse themes.

1. Install Z Shell (Zsh)

Oh My Zsh will use the ZSH shell as its foundation, and it helps customize, extend, and improve the interface and features of the ZSH terminal. Here’s the command to install ZSH:

sudo apt install zsh

2. Download the installation file

You can use curl, wget, or git to do this.

sudo apt install curl
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Install Oh My Zsh
Install Oh My Zsh

After successful installation, Oh My Zsh will automatically set ZSH as the default interface. You can check with the command:

echo $SHELL

In case ZSH is not yet the default, run the following command to set it as default:

chsh -s $(which zsh)

Or

usermod -s $(which zsh) [username]

Step 2. Configure the Terminal Interface

1. List available themes

The folder containing Oh My Zsh themes will be located in the user’s (USER) directory (~/.oh-my-zsh/themes/).

ls /home/$(whoami)/.oh-my-zsh/themes/
oh my zsh theme

Oh My Zsh will initially set the default theme to “robbyrussell”. You can easily change to any theme you want, just modify the ZSH_THEME=”theme-name” parameter in the ~/.zshrc file. (See screenshot)

Customize Oh My Zsh Theme
Customize Oh My Zsh Theme

You can also set the ZSH_THEME=”random” configuration to load random custom themes for your Terminal.

2. Configure theme change

Command to open ~/.zshrc to edit oh my zsh theme configuration:

sudo nano ~/.zshrc

After changing, you need to run this command to apply the configuration.

source ~/.zshrc

Step 3. Install plugins

Oh My Zsh provides many plugins that allow you to add more functionality to the terminal simply by activating them. These plugins are explained in detail in the plugins directory of Oh My Zsh.

You can find many plugins that support interface customization and terminal optimization for Ubuntu. Installing and configuring plugins is very simple. You just need to run the commands below and add the plugin name to the plugin section in the ~/.zshrc file.

In this tutorial, we will use 2 popular plugins: autosuggestions and autocomplete, as follows:

1: Download the plugin

Plugin source: https://github.com/zsh-users/

Autosuggestions plugin: Suggests commands in real-time based on history, saving time when typing commands.

git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions

Zsh-autocomplete: Automatically completes keywords and statements, increasing speed and accuracy when using the Terminal.

git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git $ZSH_CUSTOM/plugins/zsh-autocomplete

2. Configure Plugins

After downloading the above plugins, open the ~/.zshrc file for editing:

sudo nano ~/.zshrc

Then, add the plugin names to the plugins list as in the example:

plugins=(git zsh-autosuggestions zsh-autocomplete)
Oh My Zsh Plugin Config
Add Plugins to Oh My Zsh Config

3. Apply configuration

After editing, you need to run the following command to apply the changes:

source ~/.zshrc

This allows you to easily customize your Ubuntu terminal with Oh My Zsh and explore many other interesting features. If you have any questions, feel free to leave a comment!

Write a comment