DEV Community

Cover image for Customize Windows Terminal with WSL2
Karan Shetty
Karan Shetty

Posted on • Updated on

Customize Windows Terminal with WSL2

After customization, the terminal will look something like this:

Terminal

Pre-requisites:

  • You must have WSL or WSL2 installed in your Windows 10 PC. For installation process, you can refer the official docs or watch this video by David Combal.
  • You must have the Windows Terminal or Windows Terminal Preview version installed. The easiest and recommended way to download it is from the Microsoft Store. I prefer to use the preview version as it has more features 😁(but may have some bugs).

Initial steps

  • Open up the Windows Terminal.

  • Open up Ubuntu (or any distro you have installed) in the Windows terminal by clicking on the down arrow next to the + icon.

Alt Text

  • Run the following command to check the version of the distro you have installed.
lsb_release -a
Enter fullscreen mode Exit fullscreen mode

If everything worked fine, your distro name and version must be displayed.

  • (Optional but best practice) Run the following command to update your Ubuntu packages. For the other distros, run their respective commands.
sudo apt update && sudo apt upgrade -y && sudo apt autoremove && sudo apt autoclean
Enter fullscreen mode Exit fullscreen mode

Install zsh shell

  • Run the command:
sudo apt install zsh
Enter fullscreen mode Exit fullscreen mode
  • To check if zsh if installed, run:
zsh --version
Enter fullscreen mode Exit fullscreen mode

You must see the version of zsh shell you have installed.

  • Set zsh as the default login shell by running the following command:
sudo usermod -s /usr/bin/zsh $(whoami)
Enter fullscreen mode Exit fullscreen mode
  • Restart you computer and you must see zsh as the default login shell. 😀

Install oh-my-zsh

There are a ton of other frameworks for zsh shell like prezto, antigen, etc. My favorite is oh-my-zsh, but you can also try the other ones.

  • Run the command:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode

Yaay! It's as easy as that.
You can configure the zsh shell by making changes in the ~/.zshrc shell. This file runs every time we open the z shell just like the .bashrc file runs every time we open the bash shell.
With the help of oh-my-zsh, a lot of cool plugins can be installed to increase your productivity. Here is a guide for installing some useful oh-my-zsh plugins.

Change settings in windows terminal

  • In the windows terminal, open Settings by pressing Ctrl + ,. This should open the settings.json file in your default editor (Mine is VS Code).
  • (Optional) To make Ubuntu as your default profile, copy the guid number from the list.

Terminal Settings

and paste it at the top in the defaultProfile property.

Terminal Settings

Next time you open Windows Terminal, Ubuntu must be the default profile opened.

  • Download the Cascadia Code PL and set it as a default fontFace. (Note: Instead of Cascadia Code PL, you can install and apply one of the Nerd fonts from this website)

Alt Text

  • Set the useAcrylic and acrylicOpacity properties to add a beautiful opacity to your terminal.

Terminal Settings

If it isn't working, check if Transparency Effects is checked in Settings > Personaliation > Colors.

Settings

If you want to have a look at my full settings, here it is.
For all the available settings in the terminal, refer the official docs.

Install Powerline fonts

  • Run the following command:
sudo apt install fonts-powerline
Enter fullscreen mode Exit fullscreen mode

This must install powerline fonts so that weird symbols don't appear in the terminal.
(You can also install one of Nerd Fonts and apply it to your terminal settings).

Install Powerlevel10k theme

  • Run the command:
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Enter fullscreen mode Exit fullscreen mode
  • Open ~/.zshrc file in your favorite editor. For VS Code, run the command code ~/.zshrc. Add the line ZSH_THEME="powerlevel10k/powerlevel10k" and save.

Zshrc

  • Run the command source ~/.zshrc to apply the changes made in .zshrc file.
    Configure the p10k settings according to your liking :).

  • (Optional) After all this, the terminal should look pretty awesome. But even more customization can be made by opening the file ~/.p10k.zsh file. Check their offical github page for more info.

Done!! Your terminal must look similar to this:

Alt Text

Thank you for reading :). Please do share your feedback ✌

Top comments (3)

Collapse
 
dylajwright profile image
Dylan

Nice article, thanks for sharing.

Collapse
 
shettykaran21 profile image
Karan Shetty

Your welcome 😊

Collapse
 
simong97 profile image
Simon Gurung

Why zsh is slow compared to bash in the wsl2?