2022 Setup Guide for a cool terminal on Windows with Windows Terminal and WSL

Klaus
5 min readFeb 15, 2022

--

Recently, I had to switch from Mac to Windows for development for some reason. PowerShell is very different from a Unix-like shell and it is hard for me to get used to. Here is where Window Subsystem Linux (WSL) comes to the rescue.

In this guide, I am going to show you how to set up a cool and convenient terminal on a Windows machine with the following:

  • Windows Subsystem Linux 2 (WSL2)
  • Ubuntu on WSL
  • OhMyZsh
  • Powerlevel10k
  • Windows Terminal

The Steps

Step 1. Install WSL and reboot the machine

Go to Start > PowerShell. Then, type in the command

wsl --install

After the command runs successfully, you may have to reboot the machine for it to work.

Step 2. Install a Linux Distro

To check which distros are available, we can use wsl --list --online.

In this guide, we will install the distro Ubuntu 20.04. To install, type wsl --install -d Ubuntu-20.04.

After installation, finish the Ubuntu setup by providing a new username and password. Now you have a Linux running within your Windows! You can close the WSL window for the moment. We will come back to WSL after we install the Windows Terminal.

Finally, type wsl -s Ubuntu-20.04 in PowerShell to set Ubuntu 20.04 as the default distro

Step 3. Install and setup Windows Terminal

If you have used iTerm2 or any other modern terminal before, you may find that the experience with Command Prompt and PowerShell is not good enough.

Windows Terminal, open-sourced by Microsoft does a much better job. It supports terminal profiles, new tabs/panes, and a command palette.

To download Windows Terminal, go to the Microsoft Store and look for Windows Terminal

After installing Windows Terminal, open Settings from the menu or press Ctrl + , on your keyboard to change these settings:

  • Use Ubuntu-20.04 as default startup profile (You can switch to Command Prompt or PowerShell anytime when you open a new tab)

Step 4. Install zsh and OhMyZsh

To install zsh, run sudo apt-get update && sudo apt-get install -y zsh to update the latest package info and install zsh. Once you have installed it successfully, you should be able to see it in /etc/shells.

OhMyZsh is a framework for managing zsh configs and plugins. To install, run the command sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)". When prompted, press y to set zsh as your default shell.

As you can see at the end of the screen recording, the prompt looked different after installing OhMyZsh.

Step 5. Install and configure Powerlevel10k

Powerlevel10k is the secret sauce of creating that stunning terminal.

To install, run git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k.

Then, enable the theme by setting ZSH_THEME="powerlevel10k/powerlevel10k" in .zshrc with your favorite text editor. If you are not familiar with any screen-based text editor, you can use cd ~ && explorer.exe . to open the directory so that you can edit .zshrc on Windows.

After that, run zsh and a powerlevel10k setup menu will show up. Just follow the guide and select what looks best for you. If you can’t see the icons/glyphs, you might want to look into your font settings again.

There is something more

More command prompt elements

With powerlevel10k, you can configure what elements to show in the prompt. For example, I like to have the CPU and RAM usage displayed. To add or remove elements, modify POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS under ~/.p10k.zsh. Just uncomment the lines to enable that element and do the opposite if you want to disable it. After changing the file, run zsh to see the effects immediately.

The Command Palette

As mentioned in the Windows Terminal section, there is a command palette in Windows Terminal. You can find shortcuts and see cool functions provided by the app. Just press Ctrl + Shift + P on your keyboard to explore more!

More Color Schemes!

If you would like more color schemes for your Windows Terminal, you can find them here:

--

--

Klaus

A data engineer from Hong Kong. Share tools and experience for better productivity. Follow to get my latest stories!