Make your WSL / WSL2 terminal awesome with zsh, oh-my-zsh, nerd-fonts and powerlevel10k

I will explain to you, how to make your “wsl” or “wsl2” terminal just awesome! We’re installing Windows Terminal, which is a nice open-source project of Microsoft. And we’re installing the “zsh” shell, which will replace the default “bash” shell. This allows us to completely change the look and feel of our terminal and also enhance the functionality by installing additional zsh plugins.


Install Windows Terminal

Windows Terminal is a nice open-source project of Microsoft that can replace all your Windows terminals. It’s very powerful and offers a lot of customization features and also productivity features like tabs, tiling windows, and much more.

I followed this project since the preview version and it’s consistently improved by Microsoft’s developers. It’s very easy because you simply install it via the Microsoft Store on Windows.


Install Nerd-Fonts in Windows

To make Windows Terminal able to render the icons we’re using in “zsh” later, we need to install the Nerd-Fonts on our Windows. First, go to the Nerd-Font homepage and select a Font you like. Note that not all of them work well with all zsh themes, you may need to try out different ones. Fonts that work for me are “Anonymice Nerd Font” and “Droid Sans Mono Nerd Font”. Then, extract the archive and install all of the .otf Font files.


Install zsh shell in WSL / WSL2

Now we need to install the “zsh” shell in our wsl or wsl2. You can easily install it in the Ubuntu wsl by using the commands below. If you’re using a different Linux distribution, you may check out the zsh documentation or your package manager documentation.

We will also install oh-my-zsh which is a nice configuration extension to the “zsh” shell. That will allow us to easily customize anything, install a theme, and add plugins later.

sudo apt update

sudo apt install zsh -y

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

Install powerlevel10k zsh theme

Next, we will install the powerlevel10k theme, which really looks nice and offers great customization features. It also has a good configuration wizard that makes it extremely easy to set up the theme for your favorite design.

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

To activate the theme you need to edit your “~/.zshrc” file in your personal folder and replace ZSH_THEME=”robbyrussel” with ZSH_THEME=”powerlevel10k/powerlevel10k”. After the change, you need to close and restart your terminal.


Change Windows Terminal settings to use Nerd-Fonts

Because we want Windows Terminal to be able to render the icons in the powerlevel10k theme correctly, we need to change the Windows Terminal configuration to use the Nerd-Font we’ve downloaded before. Click on “Settings” in the Windows Terminal menu and edit the settings.json file with your favorite text editor.

Find your wsl or wsl2 profile and add the line “fontFace”: “<name-of-your-font>” according to this example:

"list":
    [
        {
            "guid": "{<your-profile-id>}",
            "hidden": false,
            "name": "Ubuntu-20.04",
            "source": "Windows.Terminal.Wsl",
            "fontFace": "<name-of-your-font>"
        }
    ]

Make sure, you’re using the exact name of the font like it’s displayed in the “Font name” section when you open the .otf font file!


Some additional settings in Windows Terminal

The settings.json file of Windows Terminal can be configured with different options. You can change the name, the icon, the default folder, font-size and many other things.

If you want to have a look at the configuration I’m using in my Windows Terminal, you can check out my dotfiles.


How to install or enable plugins in zsh

Example: Auto-suggestion plugin

I found this nice auto-suggestion plugin for the “zsh” shell. Above all, it’s really nice and helps me a lot when working with the Linux terminal. It will suggest you auto-completes based on your command history.

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

Enable the plugins in zsh

To enable the auto-suggestion plugin or any other plugins in “zsh”, edit your “~/.zshrc” file in your personal folder. Simply change the default line plugins=(git) to plugins=(git zsh-autosuggestions <optional-other-plugins>). Of course, replace the <optional-other-plugins> with any other plugins you want to enable.


Learn more about productivity on Windows

4 thoughts on “Make your WSL / WSL2 terminal awesome with zsh, oh-my-zsh, nerd-fonts and powerlevel10k”

  1. Nice video, just an advice for those watching you content on smartphone, the terminal looks small, so if you could reduce the camera size and make the Open Window bigger it will looks better.

    Reply
  2. I was waiting for this. I’ve been using cmder on windows a long time but was always impressed with (oh-my-)zsh.
    Your walkthrough is amazing. Some little feedback on vim. People warned me about it and I think it justified as I got stuck the first 5 seconds 🙂
    Some notes so you can edit the file
    Make your WSL / WSL2 terminal awesome with zsh, oh-my-zsh, nerd-fonts and powerlevel10k6. July 2020

    I will explain to you, how to make your “wsl” or “wsl2” terminal just awesome! We’re installing Windows Terminal, which is a nice open-source project of Microsoft. And we’re installing the “zsh” shell, which will replace the default “bash” shell. This allows us to completely change the look and feel of our terminal and also enhance the functionality by installing additional zsh plugins.Install Windows Terminal
    Windows Terminal is a nice open-source project of Microsoft that can replace all your Windows terminals. It’s very powerful and offers a lot of customization features and also productivity features like tabs, tiling windows, and much more.
    I followed this project since the preview version and it’s consistently improved by Microsoft’s developers. It’s very easy because you simply install it via the Microsoft Store on Windows.

    Download: https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701

    Documentation: https://docs.microsoft.com/en-us/windows/terminal/

    GitHub: https://github.com/Microsoft/TerminalInstall Nerd-Fonts in Windows
    To make Windows Terminal able to render the icons we’re using in “zsh” later, we need to install the Nerd-Fonts on our Windows. First, go to the Nerd-Font homepage and select a Font you like. Note that not all of them work well with all zsh themes, you may need to try out different ones. Fonts that work for me are “Anonymice Nerd Font” and “Droid Sans Mono Nerd Font”. Then, extract the archive and install all of the .otf Font files.

    Download: https://www.nerdfonts.com/Install zsh shell in WSL / WSL2
    Now we need to install the “zsh” shell in our wsl or wsl2. You can easily install it in the Ubuntu wsl by using the commands below. If you’re using a different Linux distribution, you may check out the zsh documentation or your package manager documentation.
    We will also install oh-my-zsh which is a nice configuration extension to the “zsh” shell. That will allow us to easily customize anything, install a theme, and add plugins later.

    sudo apt update

    sudo apt install zsh -y

    sh -c “$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”

    Documentation: http://zsh.sourceforge.net/

    Oh-My-Zsh: https://ohmyz.sh/Install powerlevel10k zsh theme
    Next, we will install the powerlevel10k theme, which really looks nice and offers great customization features. It also has a good configuration wizard that makes it extremely easy to set up the theme for your favorite design.
    git clone –depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
    To activate the theme you need to edit your “~/.zshrc” file in your personal folder and replace ZSH_THEME=”robbyrussel” with ZSH_THEME=”powerlevel10k/powerlevel10k”. After the change, you need to close and restart your terminal.

    $ vim ~/.zshrc
    make the change
    press ESC
    press colon “:”
    type x and enter

    Thank you! Mabye a video or blog post on vim is a good idea?

    Reply
  3. I was waiting for this. I’ve been using cmder on windows a long time but was always impressed with (oh-my-)zsh.
    Your walkthrough is amazing. Some little feedback on vim. People warned me about it and I think it justified as I got stuck the first 5 seconds 🙂
    Some notes so you can edit the file

    $ vim ~/.zshrc
    make the change
    press ESC
    press colon “:”
    type x and enter

    Thank you! Mabye a video or blog post on vim is a good idea?

    Reply

Leave a Comment

I accept the Privacy Policy