oh my zsh and powerlevel10k: A Match Made in Heaven

4 min


A quick and simple guide to transforming your zsh terminal shell with oh my zsh and powerlevel10k theme to make it look cool in Ubuntu and other Linux distros.

The default shell in most of the Linux distributions is bash. Bash is solid and a legacy utility. However, it lacks some customizations, such as nice colours, cursor support, etc.

You can use another shell, zsh to enjoy additional tweaks and help you to extend your Bash shell experience.

This crisp guide explains how to install zsh, oh my zsh and apply the powerlevel10k theme.

oh my zsh and powerlevel10k: Installation and configuration guide

1. Installing zsh and changing the shell

Open a terminal and install zsh using the following command applicable to your distribution.

Ubuntu, Debian, Linux Mint and all related distro

sudo apt install zsh

Fedora

sudo dnf install zsh

Arch

pacman -S zsh

After installation is complete, find out the zsh install path

whereis zsh

Then change the shell using the zsh executable path for the current user.

chsh -s /usr/bin/zsh <username>
change the shell for the current user
change the shell for the current user

Close and open the terminal again. And you should see the first-time setup for zsh. Select option 2. And it will change the look of your shell prompt with a default theme, as shown below.

first time setup for zsh
first time setup for zsh

2. Install oh my zsh

The oh my zsh is a set of scripts to customize zsh further.

Firstly, we will install oh my zsh script by downloading it from GitHub. It would be best if you had wget and git package for that. Install wget & git using the following command if it’s not installed.

sudo apt install wget
sudo apt install git

Then install oh my zsh using the following command.

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

And you should see the oh my zsh theme is applied with a default theme robbyrussell to your terminal.

Install oh my zsh and default theme
Install oh my zsh and default theme

The Oh my zsh also comes with additional themes, and you can install them using this guide. However, in this tutorial, I will talk about a specific theme, i.e. powerlevel10k.

3. Install powerlevel10k theme for oh my zsh

Open a terminal and run the following command to clone powerlevel10k repo from GitHub and put the files in the config folder of oh my zsh.

git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

Open the ~/.zshrc file in a text editor and set the ZSH_THEME variable to "powerlevel10k/powerlevel10k".

cd ~
nano .zshrc

By default, it should be robbyrussell. Remove “robbyrussell” and add the below "powerlevel10k/powerlevel10k".

Your ~/.zshrc file should look something like this after the change:

ZSH_THEME="powerlevel10k/powerlevel10k"

Save and close the file (CTRL+O, ENTER and CTRL+X).

change oh my zsh theme to powerlevel10k
change oh my zsh theme to powerlevel10k

Restart your terminal to launch the first-time wizard to set up the powerlevel10k theme.

4. First time set up for powerleve10k

When you launch the terminal after the installation, the powerlevel10k prompts you with various questions to understand your Linux distro setup. So, press the key as per your need to customize your terminal as per your taste. Some example screenshots of questions are below to give you some idea.

powerlevel10k - wizard1
powerlevel10k – wizard1
powerlevel10k - wizard 2
powerlevel10k – wizard 2

And finally, you can save the file to enjoy the new look of your terminal.

After applying settings in powerlevel10k zsh theme
After applying settings in powerlevel10k zsh theme

If you want to restart the configuration wizard again, run the following. You can do it as many times as you want.

p10k configure

This concludes the basic setup. If you want more, follow along.


More configuration (advanced usage)

5. Installing dracula GNOME Terminal theme

If you are using GNOME desktop with the native terminal, you can try the stunning drakula theme. To do that, open a terminal and run the following command to download the theme.

git clone https://github.com/dracula/gnome-terminal
cd gnome-terminal

Open GNOME Terminal and go to preferences. Add a new profile by clicking on the [+] and name it “drakula”. Then go to colours tab and uncheck ‘use colors from system theme’ option.

create a new profile for terminal
create a new profile for terminal

Go back to the terminal and run the following. When prompted, select the profile name which you just created as above.

./install.sh
applying the drakula theme for gnome terminal
applying the drakula theme for gnome terminal

Once the installation is complete, go back to preferences and mark the drakula profile as default.

6. Autocomplete and syntax highlighting for zsh

There are two community-developed plugins available for zsh, which you may want to try out. They are zsh-autosuggestions and zsh-syntax-highlighting.

Open a terminal and run the following to download zsh-autosuggestions and put it inside the plugin folder.

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

Similarly, run the following for the syntax highlighting plugin.

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

Open the ~/.zshrc file via a text editor (use the following command), and find the plugins=(git) line. And replace it with the following:

nano ~/.zshrc
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

Save & close the file using CTRL+O, ENTER and CTRL+X.

Close and open your terminal; now, you should be able to use the auto-suggestions and syntax highlighting.

Wrapping Up

That’s it! You should now have “Oh My Zsh” and the Powerlevel10k theme installed on your system. You can customize the appearance and behaviour of the Powerlevel10k theme by customizing further as per your need.

Cheers.


Arindam

Creator of debugpoint.com. All time Linux user and open-source supporter. Connect with me via Telegram, Twitter, LinkedIn, or send us an email.
Subscribe
Notify of
guest

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

3 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments