My Ubuntu Terminal with Zsh and Oh my Zsh!

If you spend lots of time on your terminal like me. It’s time to consider making your terminal looks better and help you to improve your productivity as well as save your time and energy.

If you spend lots of time on the terminal, why it looks dirty. Let's make it pretty.

Why zsh?

Ok. Great question. I appreciate you.

zsh has a powerful default auto-completion feature, as well as more configuration options. zsh the configuration has an open-source, community-driven framework oh my zshand it has thousands of helpful functions, helpers, plugins, themes.zsh is also compatible with bash syntax.

Install Zsh

In our system default shell is bash. To use zsh we have to change our default shell bash to zsh. To do that we have to install zsh on our system. Open you terminal and execute it.

Check successfully installed or not.

If you get any error try to find out on your own. Google it.

Change shell

Our system’s default shell is bash. We have to change it to zsh.

chsh stands change shell. After changing the shell we have logged out from our terminal or restart the PC. Then when you open the terminal again zsh will prompt zsh configuration function. We can follow the instruction to configure the shell. But we want to quit and do nothing by pressing 0.

Install Oh My Zsh!

We can install it by using two ways curl and wget. You can whatever you prefer.

or,

After successfully done that. WooHoo! Our terminal prompt changes. Now play around.

It gives auto-completion ability and switches through commands, folders, and files by pressing tab.

Highlight prompt green when the previous command executes successfully and red when giving errors.

How do you feel? Is it cool?

Tweak .zshrc

To do that we will tweak our .zshrc file.

You see, there are many configurations is comment out. We need to change some of them.

  • Comment out $PATH
  • Enable auto-correction by settingENABLE_CORRECTION=”true”
  • Auto-update time by settingUPDATE_ZSH_DAYS="how many days you prefer"
  • Other bash configurations like nvm, add them to the end of the file (if you have).

Auto-correction will suggest a command correction if it detects a mistyped command.

The 4 options are:

  • n (no): run the mistyped command
  • y (yes): run the suggested command
  • a (abort): stop and do nothing
  • e (edit): edit your command before re-running it

Change Theme

If you want to change the theme, you can explore here your favorite one. If you find one. To add this ZSH_THEME=”theme name” inside .zshrc file and save. Then run

The default one is my favorite.

Add Plugins

Now we want to make it more cool using oh my zsh plugins. We have already git plugin added by our default theme.

  • colored-man-pages

We need to read details about commands often, to do that we use man command. That is hard to read. colored-man-pages help us read easily. This plugin highlight text.

To add thisplugins=(git colored-man-pages) inside .zshrc file and save. Then run

Now man page will look like this.

  • zsh-autosuggestions

colored-man-pages was a default install. But we have to add it. To do clone the plugin inside that.

Then add thisplugins=(git colored-man-pages zsh-autosuggestions) inside .zshrc file and save. Then run

This plugin is very handy when you want to run the previous command again. It will show matching command from our commands history. We can switch commands using the arrow keys.

When I type cd I will get immediate suggestions.

Accept by pressing the right arrow key.

  • zsh-syntax-highlighting

we have to add it. To do clone the plugin inside that.

Then add thisplugins=(git colored-man-pages zsh-autosuggestions) inside .zshrc file and save. Then run

It highlights command within the command line. It also colorizes the name of the command you type in green if it is found, and in red if not.

If found the command

If not found the command

Last word

Here is show my favorite plugins and theme. You can find your favorite themes from here and plugins from here. And let me know what is your favorite theme and plugin.

Welcome to the beautiful terminal. Enjoy it!

Developer, Book lover.