In-Depth Windows Terminal Customization for WSL2 (Win11 Ready!)

Alright, since we now know how to Install WSL2 on Windows and How to Customize Windows Terminal for WSL2, it’s time to take a deep dive into Terminal Customization for WSL2.

Initially, I wanted to go with showing you how to install ZSH, Oh My ZSH, and an Oh My ZSH Theme called PowerLevel10k.

But last minute, I changed my mind. A reader, Nir Adler, has pointed me to Oh My Posh in the comment section of the WSL 2 customization article. I just had a look at it and tried it out and I’m hooked. I decided to write this article for Oh My Posh instead of Oh My ZSH, but you’ll see why in just a second.

Let’s dive right into it: Terminal Customization for WSL2!

Side-note: I am doing this tutorial on Windows 11, it will work on Windows 10 just the same.

⚠️This is a Tutorial Series⚠️
Part 1How to install WSL 2 with Windows Terminal – Complete Guide
Part 2Windows Terminal Customization for WSL 2
Part 3In-Depth Windows Terminal Customization for WSL2

Table of Contents

Requirements

I assume that you have followed Part 1 and Part 2 of the tutorial series, this is where we will pick up. However, if you haven’t followed that, it does not really matter, this tutorial will work for you regardless, your terminal will just look a bit different than mine at the end!

Part 1 – Install ZSH on WSL2

First things first – installing ZSH on WSL2 and making ZSH the default shell.

sudo apt update sudo apt install zsh -y

And make ZSH the default shell.

chsh -s $(which zsh)
Code language: JavaScript (javascript)

Now restart Windows Terminal, you’ll be greeted by ugly ZSH config text.

In here, select option 2 (press 2 on your keyboard) for the default settings.

Terminal Customization

Congratulations! You now have set ZSH as your (still very ugly) default shell! Let’s move on

Part 2 – Installing Oh My Posh

Now we can go ahead with our terminal customization and install Oh My Posh.

First, we need to install Oh My Posh and “unzip” so we are able to unzip the files in a second.

sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh sudo chmod +x /usr/local/bin/oh-my-posh sudo apt install unzip
Code language: JavaScript (javascript)

Next up, we download the themes.

mkdir ~/.poshthemes wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip unzip ~/.poshthemes/themes.zip -d ~/.poshthemes chmod u+rw ~/.poshthemes/*.json rm ~/.poshthemes/themes.zip
Code language: PHP (php)

Part 3 – Installing Nerd Fonts

To be able to display all those nice custom icons, we are going to use Nerd Fonts. Or more specifically, the MESLO LGM Nerd Fonts, which are recommended by Oh My Posh.

You can download them directly here. Just save them on your computer, unzip them and install all of them at once by selecting all of them and right-clicking them, selecting Install.

WSL2 Customization

Good, now we are almost finished!

Open up the settings of Windows Terminal, navigate to your instance, click on Appearance, select Show all fonts and then choose MesloLGM Nerd Font. Click on Save and restart your Windows Terminal for good measure.

Terminal Customization

Part 4 – Activating Oh My Posh

Alright, now we need to add some code to our zshrc file, specifically which theme Oh My Posh should use. That’s a necessary step for terminal customization.

Open your .zshrc file and add the following two lines at the bottom of it.

Opening the file

nano ~/.zshrc

Adding the code at the bottom

# Oh My Posh Theme Config eval "$(oh-my-posh --init --shell zsh --config ~/.poshthemes/jandedobbeleer.omp.json)"
Code language: PHP (php)

Tip: Should you follow this tutorial on macOS, the path to the themes folder is a bit different since we need to use homebrew to install stuff on Mac. So if you are on mac use the code below.

# Oh My Posh Theme Config on macOS eval "$(oh-my-posh --init --shell zsh --config $(brew --prefix oh-my-posh)/themes/bubblesline.omp.json)"
Code language: PHP (php)
Terminal Customization

Press CTRL + O and then Enter to save your file and CTRL + X to close the file.

Finally, activate the new theme.

source ~/.zshrc

And you should be looking at something like this.

Terminal Customization

Woohooo! You made it.

Part 5 – Changing the Theme

This is probably what interests you most since you want to check out all the shiny themes!

Gladly, it’s very easy to change the theme. For a list of themes, check here or run the command below.

for file in ~/.poshthemes/*.omp.json; do echo "$file\n"; oh-my-posh --config $file --shell universal; echo "\n"; done;
Code language: JavaScript (javascript)

When you have found a theme that you like, you find its name right above it. Let’s say we want to use the half-life theme. That means we need to copy the half-life.omp.json name and replace it inside of our .zshrc file.

WSL2 Customization

nano ~/.zshrc

Simply scroll down where you added your # Oh My Posh Theme Config and replace the old jandedobbeleer.omp.json with the new half-life.omp.json name.

WSL2 Customization

CTRL + O and Enter and CTRL + X your way out of nano and restart your Windows Terminal (source ~/.zshrc doesn’t work for me on Windows 11).

WSL2 Customization

Voila! You made it.

Part 6 – Installing more Themes for Oh My Posh

Let’s say you find a theme somewhere else that isn’t included with Oh My Posh. It’s very easy to install it, granted the file is coming in the .omp.json format.

All we have to do is clone the file into our themes folder. Let’s assume the M365 Princess Theme was not included. To download it we would simply need to clone it into our themes folder.

cd ~/.postthemes git clone https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/themes/M365Princess.omp.json
Code language: PHP (php)

And then repeat Part 5 to set the theme. That’s it.

Part 7 – Install ZSH Autosuggestions on WSL2

One elemental tool in my repertoire is ZSH-Autosuggestions. This tool basically learns from you while you are working and automatically suggests things to you.

For instance, if you regularly navigate to your projects folder with cd projects, zsh-autosuggestions will automatically suggest you the command when you start typing cd. If you then simply hit the right-arrow key, the command will be written.

I love this and it is an essential tool for me.

First, we clone zsh-autosuggestions.

git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
Code language: PHP (php)

And then we add the following line, once again, to our .zshrc file.

nano ~/.zshrc

And add the following code at the bottom like before with Oh My Posh.

# ZSH Autosuggestions source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
Code language: PHP (php)

CTRL + O and Enter and CTRL + X your way out of there like the Nano champ you already are and finally restart Windows Terminal once again.

And as promised, it works!

WSL2 Customization

Conclusion

Oof, that was a trip! After following this terminal customization series, you should now be able to understand how to produce a beautiful terminal!

There are about a myriad ways on how to tweak and customize things even further, which of some I will keep adding to this article (so make sure to bookmark it!).

As for now, make sure to also check out Oh My ZSH and then simply pick your poison. It’s all up to personal preference. I will also add an Oh My ZSH section with PowerLevel10k to this guide, later on, so you can compare on the fly!

I would be happy to see how you end up customizing your own terminal, so either tag me on Twitter with @ceos3c or post a screenshot of your terminal in the comment section below!

Happy customizing!

✅ The Best Way to stay Up-to-Date with my Content

Tell us what you think!

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