Make Your Ubuntu Terminal Look *Scintillating*

Kevin Feng
Nerd For Tech

--

Have you ever wondered what it would be like not to have a boring and bland terminal? Well, wonder no longer. Today, we’re going to be going over how to install Oh My Zsh for Ubuntu. I’ve found that the video guides on YouTube involving Oh My Zsh and Ubuntu are somewhat limited (most guides are on MacOS using iTerm2, which is a Mac exclusive terminal emulator), so I’m creating this guide in an effort to fill that void.

If you want to know how to install Ubuntu via a virtual machine to your Windows computer, check out my previous blog post here. You’ll also need a Nerd Font for all the fancy symbols and glyphs that Oh My Zsh uses, and you can find out how to install one under the Nerd Font section of my previous blog post. Once you have Ubuntu and a Nerd Font in your terminal, we can get started!

Part 1: Installing Zsh

We’ll first need to install Zsh, or Z shell. Open up your boring-looking GNOME terminal with CTRL + ALT + T and execute

sudo apt install zsh

Once Z shell has installed, we’ll have to change the default shell from bash to Zsh. You can confirm that bash is the current shell by executing

echo $0

which should print out bash. Then execute the chsh (change shell) command, which will begin a short CLI that asks for your password, as well as the new path for the shell you want to change to. Simply enter /bin/zsh. Now performing echo $0 won’t print out zsh like you might expect. We’ll have to first log out and log back in to the OS. An easy way to accomplish this is to just run

sudo reboot now

in the terminal. Once Ubuntu finishes rebooting, log back in and open another instance of GNOME terminal. This time, you’ll get a prompt for setting up Zsh:

Go for the second option, so just enter 2 and you’ll instantly be in Z shell. Now when you execute echo $0, zsh should be the output.

Part 2: Installing Oh My Zsh

Now that Zsh is installed, we can install Oh My Zsh very easily with a simple curl command:


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

If you don’t have curl or git, simply install those with sudo apt install curl or sudo apt install git, respectively. Once you execute the curl command to install Oh My Zsh, you should be met with this very pretty title written in ASCII:

Part 3: Installing Powerlevel10k

Now let’s make Oh My Zsh look amazing with Powerlevel10k, which is a Zsh theme. All we have to do is execute this

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

and then add Powerlevel10k as the Zsh theme for our config. To do that, we’ll want to open the .zhrc file with some kind of text editor. If you have Neovim installed, just run:

nvim ~/.zshrc

Use gedit if you do not have Neovim, or just feel free to use whatever text editor you wish.

You should see a file that looks something like this. Change ZSH_THEME on line 11 to "powerlevel10k/powerlevel10k". If you’re using some type of Vim editor, don’t forget to write your changes with :w. We’ll want to close this terminal and open a new one to start configuring Powerlevel10k, but since Oh My Zsh is still running, just execute exit before closing the terminal (otherwise you’ll get a warning about processes still running via the terminal, it’s just good practice to do this).

Open another terminal with CTRL + ALT + T and you’ll see the Powerlevel10k configuration wizard:

If the icon between the two arrows of the first prompt fails to resemble a diamond entirely, then you don’t have a Nerd Font installed. As mentioned earlier in this blog post, I have a short guide in this section of my previous article.

The Powerlevel10k configuration wizard will first confirm that the symbols of your Nerd Font are working properly. Just respond with y for “yes” and n for “no.” After that, the configuration wizard will start asking for some visual preferences of how you want your command line to look like. If you want to copy the settings that I have, just refer to the images below (the captions denote which input correlates with that style):

(3) Rainbow
(1) Unicode
(3) 12-hour format
(1) Angled
(1) Sharp
(1) Flat
(2) Two lines
(3) Solid
(4) Full
(1) Lightest
(2) Sparse
(2) Many icons
(1) Concise
(y) Enable transient prompt
(1) Verbose

And finally, we allow the configuration wizard to apply the changes to our config file:

(y) Yes

And we’re done! Now your terminal doesn’t look so boring anymore.

The best part about Powerlevel10k is how easy it is to change the appearance of your terminal. Let’s say you’ve tested out your initial preference selections for a few hours, and something seems a bit off about it. Simply run

p10k configure

and the Powerlevel10k configuration wizard will start up again. From there, make whatever changes you see fit until you finally achieve that *scintillating* look that you’re after.

I actually changed my Powerlevel10k configuration midway through writing this… (as you’ll see in the remaining screenshots)

Part 4: Installing other plugins

To make our terminal even cooler, we’re going to install a few plugins. The two most important ones that come to mind are syntax highlighting and autosuggestions. For the syntax highlighting, we’re going to use zsh-syntax-highlighting. To install it, just run the following:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc

Now the syntax highlighting plugin does NOT need to be referenced in the .zshrc plugins section. It just needs to be sourced, which is why in the previous set of commands we used echo to add a line to the .zshrc.

Let’s also install a plugin for autosuggestions, which will allow the terminal to suggest autocompletions based on our command history. For this functionality, we’re going to use zsh-autosuggestions. Let’s run

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

and then edit the .zshrc file again. Once again, I’ll use nvim ~/.zshrc.

On line 80, we’ll want to add the autosuggestion plugin that we just installed (remember that the syntax highlighting one should NOT be referenced in this bit of code). Let’s modify line 80 to look like this:

plugins=(git zsh-autosuggestions)

Save your changes, exit whatever text editor you’re using, and then run

source ~/.zshrc

to compile your changes. And now you should have syntax highlighting and autosuggestions enabled for your terminal! If you want to complete the autosuggestion that your terminal is giving, just hit the right arrow key.

Notice the red and green syntax highlighting; pressing the right arrow key at this point will also make the terminal complete the autosuggestion that it’s providing.

And just for a little something extra, let’s install colorls so that we can get a really nice looking ls command. Here’s the link to the installation guide. First, let’s install Ruby:

sudo apt-get install ruby-full

Then let’s install colorls with Ruby:

sudo gem install colorls

Once it’s installed, we can technically start using colorls right away, but typing out colorls explicitly every time we want to list our files isn’t really intuitive:

So let’s go back into our .zshrc file and at the bottom, let’s add this alias:

alias ls='colorls'
As a bonus, you can add line 112 for tab completion for flags

And now, executing ls should do the same thing as colorls:

Conclusion

Oh My Zsh is an amazing tool to customize your terminal. Don’t feel limited to only use the plugins that I’ve provided here. There is a plethora of plugins that you can find to further customize your terminal; here are just a few that you might want to look at.

And if you ever get confused on what type of plugin you should try out next, don’t be afraid to consult YouTube. Even though I mentioned earlier that the Ubuntu + Oh My Zsh tutorials were pretty limited, you can learn a lot from the ones that are for other operating systems (that’s actually how I learned how to install the plugins). Of course, make sure to reference documentation and forums for additional help while configuring these kinds of things. I’ve found that one tutorial is never enough to cover all the bugs or little errors that I run into.

Well, that’s all I have for today. Have fun perfecting your terminals!

Sources

https://youtu.be/PZTLIVQxxEY

https://www.youtube.com/watch?v=wNQpDWLs4To

--

--

Kevin Feng
Nerd For Tech

Scholastic award-winning writer, programmer, and avid water drinker.