Linux terminals are boring. Here’s how I made it awesome with Oh My Zsh

Vignesh
5 min readJul 7, 2021
A typical terminal

Working with the terminal is essential for a developer, and in most cases, the terminal looks boring compared to the modern GUI, that is until now. Meet Oh my Zsh, A custom addon to the zsh shell which extends its functionality. In the end, one may get a cool terminal like this one.

ZSH terminal with Oh my zsh

What’s the advantage?

Well, there’s a lot. Have you ever wished your terminal has lots of themes? Have you ever wished your terminal has autocompletion features? Have you ever wished your terminal has syntax highlighting and many more cool features that can even enhance your workflow? Well, oh my zsh has a lot of plugins that will aid you so much.

Some basic info…

A shell is a component that communicates with your OS kernel where users give the text commands. The commands are parsed with a parser and the instructions are executed. There are a lot of shells like bash, sh, zsh, etc for the UNIX family of Operating Systems. (Includes both UNIX-based (Ex: macOS) and UNIX-like Operating Systems (Ex: GNU/Linux). By default, UNIX family Operating Systems ship with bash. The command prompt and the Windows Powershell are some of the shells present in Microsoft Windows. Unfortunately, the UNIX shells mentioned earlier won’t work with Windows (since it uses Windows NT kernel, which is very different from that of UNIX). So, this article applies only to the UNIX family of Operating Systems.

How do I install it?

To install Oh my zsh, one has to install zsh first.

  1. Type the following in your terminal

For Debian/Ubuntu-based distributions

apt install zsh

For RHEL based distributions

dnf install zsh

For Arch-based distributions

pacman -S zsh zsh-completions

For macOS

brew install zsh

2. After zsh is installed, one has to replace zsh over bash as a default shell using the following command

chsh -s $(which zsh)

3. Now, the zsh is made the default shell. To start zsh for the first time, just type zsh in your terminal and you will get an output similar to this.

This is the Z Shell configuration function for new users,
zsh-newuser-install.
You are seeing this message because you have no zsh startup files
(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
~). This function can help you with a few settings that should make your use of the shell easier.
You can:

(q) Quit and do nothing. The function will be run again next time.

(0) Exit, creating the file ~/.zshrc containing just a comment.
That will prevent this function from being run again.

(1) Continue to the main menu.

(2) Populate your ~/.zshrc with the configuration recommended by the system administrator and exit (you will need to edit the file by hand if so desired).

— — Type one of the keys in parentheses — -

4. Type 2 to start over the .zshrc file with recommended configuration.

5. The default zsh terminal will look something like this.

A default zsh terminal

6. Next, install Oh my zsh addon to our zsh terminal. According to official documentation, it can be installed via wget or curl. One can check it by using which command and it should give you an output like this.

To install oh my zsh via wget, type the following

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

To install oh my zsh via curl, type the following

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

Your terminal will now look something like this.

7. To change the theme, one has to edit the file. Now, to open .zshrc the file with nano, type

nano ~/.zshrc

8. Navigate with the arrow keys to uncomment the ZSH_THEME variable and add any of the themes from oh my zsh. You can find the themes here. I chose “agnoster” in my case.

9. To save the file and quit, press Ctrl + X or Command + X and press Y, and then press enter.

10. To update the changes in the terminal, type the following in the terminal

source ~/.zshrc

If that doesn’t work, close your terminal and open it again, and you will see your favourite theme applied. Note that some themes might not work properly since you need to use only powerline fonts for them which you can check out here.

11. Now, to install the syntax highlighting and auto-suggestions plugins, one has to enter the following commands

For syntax highlighting plugin

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

For auto-suggestions plugin

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

12. To add the functionality in our terminal, open the .zshrc file in nano with the command

nano ~/.zshrc

13. Now, head over to plugins section and you will see git plugin preinstalled. To add the other two plugins which we have just downloaded, add them next to git with a space. Your plugins variable should look like this one.

There are a lot of other plugins to choose from. You can see them here.

14. To update the changes, type the following command and reopen the terminal window.

source ~/.zshrc

You should now see both the new plugins in action.

Auto-Suggestions in Oh my zsh
Syntax Highlighting in Oh my zsh

Oh my zsh extends the functionality and looks way more than the regular terminal which we’re used to. There is a lot of cool stuff which you can do with this tool. Stay tuned for more tech articles. Thank you for reading.

--

--

Vignesh

AI Enthusiast | Software Developer | Python | Linux | TensorFlow | YouTuber | Open Source | Electronics Undergrad | Tech Blogger