The terminal can be defined as an interface that allows you to interact with the computer via the command line. It provides a way to input and run commands and then receive the text-based outputs. The terminal allows system admins to perform tasks quickly and efficiently as compared to navigating through the GUI. It also allows remote access, scripting and automation of tasks. The terminal is available on various operating systems, for example, Command Prompt on Windows, Shell (Bash, Zsh, etc. on Unix systems etc.

In this guide, we will learn how you can tweak your terminal using Powerlevel10k as your Zsh Theme on Linux / macOS. Users who love to have an appealing look and feel constantly look for ways to make their terminal appealing. One of the tools you can use to do that is Powerlevel10k.

Powerlevel10k is a Zsh theme that strongly emphasizes flexibility, speed and the out-of-box experience. This tool comes with a lot of features and benefits, among them are:

  • Configuration wizard: You are able to access the built-in configuration by typing p10k configure straight from your terminal. This allows you to perform desired customizations to your terminal
  • Uncompromising performance: Powerlevel10k is so fast that if you press the Enter button, the next prompt appears instantly. Users never experience a prompt lag no matter what they are doing.
  • Powerlevel9k compatibility: It is able to read and understand all the Powerlevel9k configuration parameters. The migrations from Powerlevel9k to this version is easy and straightforward.
  • Pure compatibility: It can be used to produce a similar prompt to Pure. You can configure it to use the Pure style.
  • Show on command: This feature allows you to see contexts as you switch between environments. For example when switching between Kubernetes contexts.
  • Transient prompt: If this feature is enabled, you will be able to trim down every prompt when accepting a command line.
  • Extremely customizable: It can be tweaked to look like any other Zsh theme out there. It has PurePowerlevel9k and robbyrussell emulations built-in. It is also possible to emulate other themes by writing your configuration.

Follow the below steps to learn how you can configure Powerlevel10k as your Zsh Theme on Linux / macOS

1. Install ZSH Shell on your System

You need to have ZSH shell and other required tools installed on your system. To achieve that, run the below commands:

##On Debian/Ubuntu
sudo apt update && sudo apt install zsh curl git wget

##On Rhel-based systems
sudo yum install zsh curl git wget

##On Arch-based systems
sudo pacman -S zsh curl git wget

##On Gentoo
emerge --ask zsh curl git wget

##On MacOS
brew install zsh curl git wget

Once installed, verify with the command:

$ zsh --version 
zsh 5.8 (x86_64-redhat-linux-gnu)

Now you need to make it the default shell. Use the below commands:

##On Linux
sudo chsh -s $(which zsh) $USER

##On MacOS
chsh -s /bin/zsh

Now log out and log in to the system and proceed as shown:

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 being run again.

(1)  Continue to the main menu.

--- Type one of the keys in parentheses --- 
0

After this, you will be fit to go!

2. Install Oh My Zsh (framework for managing your zsh configuration)

To be able to make customizations to ZSH, we need to have Oh My Zsh installed. This framework comes with innumerable plugins and themes for ZSH.

To install it, execute the below command, but ensure you have curl installed on your system.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

On successful installation, you will see this:

Configure Powerlevel10k as your Zsh Theme

3. Install PowerLeve10K theme

Now to tweak ZSH, we will install the PowerLevel10k theme. To achieve this, clone the GitHub repository that contains the package.

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

Alternatively, you can install the PowerLeve10K theme using the below commands:

##On MacOS
brew install powerlevel10k
echo "source $(brew --prefix)/share/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc

##On Arch Linux
yay -S --noconfirm zsh-theme-powerlevel10k-git
echo 'source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc

##On Alpine Linux
apk add zsh zsh-theme-powerlevel10k
mkdir -p ~/.local/share/zsh/plugins
ln -s /usr/share/zsh/plugins/powerlevel10k ~/.local/share/zsh/plugins/

Once installed, you can proceed and install any custom fonts if you want them. PowerLeve10K works best with Nerd FontsSource Code ProFont AwesomePowerline, and even the default system fonts.

In this guide, we will install the Nerd Fonts.

##On Linux
mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts && curl -fLO https://github.com/ryanoasis/nerd-fonts/raw/HEAD/patched-fonts/DroidSansMono/DroidSansMNerdFont-Regular.otf

##On MacOS
cd ~/Library/Fonts && curl -fLO https://github.com/ryanoasis/nerd-fonts/raw/HEAD/patched-fonts/DroidSansMono/DroidSansMNerdFont-Regular.otf

4. Configure Powerlevel10k For Zsh

There are several configurations you can do to tweak Powerlevel10k for ZSH. Here are some of the configurations you can make:

a. Enable autosuggestion and syntax highlighting

First, close the below repos:

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

Open the default configuration file for ZSH:

vim  ~/.zshrc

In the file, find and modify the line:

ZSH_THEME="powerlevel10k/powerlevel10k"

##To use Nerd Patched font
POWERLEVEL9K_MODE="nerdfont-complete"

##To enable auto correction(uncoment the line)
ENABLE_CORRECTION="true"

##Enable plugins for autosuggestion and syntax highlighting
plugins=(git)
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

Save the file and proceed

b. Configure your terminal font

To change the font, you need to open the terminal and go to preferences. Once here, you can change your font to the custom font you installed.

Configure Powerlevel10k as your Zsh Theme 1

c. Configure ZSH appearance

Finally, we need to configure the appearance of our terminal. To achieve that, run the command:

p10k configure

In some cases, the configure window might appear when you try to log in and log out of the system.

Proceed and make the configurations to your shell as shown:

Configure Powerlevel10k as your Zsh Theme 2

Here, I will go for Lean, you can choose any other as desired.

Configure Powerlevel10k as your Zsh Theme 3

Configure transient prompt:

Configure Powerlevel10k as your Zsh Theme 4

Once complete, you will have the theme enabled on your terminal as shown.

Configure Powerlevel10k as your Zsh Theme 5

Closing Thoughts

That marks the end of this tutorial on how to configure Powerlevel10k as your Zsh Theme on Linux / macOS. There are many other tweaks you can perform for Powerlevel10k, please feel free to explore them on your own by visiting thePowerlevel10k GitHub page .

See more:

LEAVE A REPLY

Please enter your comment!
Please enter your name here