Powerlevel10k is a fast yet flexible Zsh theme that comes with a plethora of configuration options.
It’s one of the most popular themes for Oh My Zsh. The theme has various customization options for prompt customization, which includes options for changing theme colors and adding, removing, or rearranging the prompt elements. The theme also offers a mode for users who are new to Zsh and Oh My Zsh, which makes it easier to get started with the theme.
In this tutorial, you’ll learn how to install Powerlevel10k with Oh My Zsh and configure it on your system.
Table of Contents
Prerequisites
To install Powerlevel10k with Oh My Zsh you’ll need the following:
- Zsh installed on your system. To do this you can use our tutorial on How to Install Zsh on Linux. Zsh is a Unix-based scripting shell. A great benefit of using Zsh is that it is way more configurable and offers support for plugins and themes.
- Oh My Zsh installed on your system. You can achieve this using our tutorial on Installing Oh My Zsh on Linux. Oh My Zsh is a community framework that is used to manage the Z shell configuration.
- Git installed on your system. We’ll quickly cover how to install it on Debian/Ubuntu-based systems or RHEL-based systems:
- On Debian/Ubuntu-based systems run:
sudo apt update sudo apt install git
- On RHEL-based systems run:
sudo dnf update sudo dnf install git
- On Debian/Ubuntu-based systems run:
Install the Powerlevel10k Theme
To install the Powerlevel 10k theme we need to clone the GitHub repository first. Execution of the following command will achieve this.
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
The output from the execution of the above command is shown in the picture below.
Applying the Powerlevel10k Theme
Now that our desired theme for the Z shell has been installed, we need to go into the .zshrc
file and change the default theme it is operating on.
To do this open the .zshrc
file with any text editor of your choice. I am using the nano
editor to edit the file. Execute:
nano .zshrc
The .zshrc
file looks like the picture below.
We need to apply the newly downloaded Powerlevel10k theme by editing this file. The above picture shows the theme that is currently being used by the Z shell in robbyrussell
.
Make this line into a comment and add this new line ZSH_THEME="powerlevel10k/powerlevel10k"
to apply the theme. The file should look like the following prompt after you’re done editing.
“ GNU nano 4.8 .zshrc Modified # If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH # Path to your oh-my-zsh installation. export ZSH="$HOME/.oh-my-zsh" # Set name of the theme to load --- if set to "random", it will # load a random theme each time oh-my-zsh is loaded, in which case, # to know which specific one was loaded, run: echo $RANDOM_THEME # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes #ZSH_THEME="robbyrussell" ZSH_THEME="powerlevel10k/powerlevel10k"
Notice that we’ve commented the previous theme and added a new line specifying Powerlevel10k as the Zsh
theme.
Now press Ctrl+x
to save changes. When asked if you want to save these changes enter Y
and hit Enter
.
After exiting the .zshrc
file we need to source it in order to complete applying the new theme.
Execute the below command and answer the prompts to do this.
source .zshrc
Above command will take you to the following prompt.
As the above shape doesn’t look like a diamond, I am going to press n
to continue.
The prompt is going to ask you multiple questions like the one shown in the above picture. Answer those accordingly to set up the theme properly.
After these questions, the prompt will ask you about your preferences like what style, line spacing, etc you want. One of the questions is shown in the picture below for reference.
Answer these questions according to your preferences. After preferences, you will be asked the following question.
Enter 1
to select Verbose
.
Then you will be asked whether you want to save changes or not as shown in the below prompt. This is the final question.
" Apply changes to ~/.zshrc? (y) Yes (recommended). (n) No. I know which changes to apply and will do it myself. (r) Restart from the beginning. (q) Quit and do nothing. Choice [ynrq]:"
Type y
to save changes and exit.
Congratulations, we have installed the Powerlevel10k theme for Zsh using Oh My Zsh.
Conclusion
In this tutorial we’ve explored how to install and configure Powerlevel10k, a fast yet flexible Zsh theme that comes with a plethora of configuration options.