Customize Windows Terminal with WSL2
Tags: linux, wsl, tutorial, windows
Published: 2020-08-22 12:02:24

After customization, the terminal will look something like this:

![Terminal](https://dev-to-uploads.s3.amazonaws.com/i/d6rjuu92gqjohg1utegz.png)

### Pre-requisites:
- You must have WSL or WSL2 installed in your Windows 10 PC. For installation process, you can refer the [official docs](https://docs.microsoft.com/en-us/windows/wsl/install-win10) or watch [this](https://youtu.be/_fntjriRe48) video by [David Combal](https://www.youtube.com/channel/UCP7WmQ_U4GB3K51Od9QvM0w).
- You must have the [Windows Terminal](https://github.com/microsoft/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](https://dev-to-uploads.s3.amazonaws.com/i/b8u2alifcdbcdfi24apd.png)

- Run the following command to check the version of the distro you have installed.
```
lsb_release -a
```
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
```

### Install zsh shell

- Run the command: 
```
sudo apt install zsh
```
- To check if zsh if installed, run:
```
zsh --version
```
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)
```

- 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](https://github.com/ohmyzsh/ohmyzsh), 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)"
```
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](https://medium.com/@ivanaugustobd/your-terminal-can-be-much-much-more-productive-5256424658e8#:~:text=Functional%20%E2%80%94%20let%E2%80%99s%20put%20a%20s%CC%B6m%CC%B6i%CC%B6l%CC%B6e%CC%B6%20%CC%B6o%CC%B6n%CC%B6%20%CC%B6t%CC%B6h%CC%B6a%CC%B6t%CC%B6%20%CC%B6f%CC%B6a%CC%B6c%CC%B6e%CC%B6%20lot%20of%20cool%20features%20in!) 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](https://code.visualstudio.com/)).
- (Optional) To make Ubuntu as your default profile, copy the `guid` number from the `list`.

![Terminal Settings](https://dev-to-uploads.s3.amazonaws.com/i/zoa4hwhvh7n6zc21wnvp.png)

and paste it at the top in the `defaultProfile` property.

 ![Terminal Settings](https://dev-to-uploads.s3.amazonaws.com/i/l4k4t7w9dotnqpbwrjqp.png)

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

- Download the [Cascadia Code PL](https://github.com/microsoft/cascadia-code/releases) 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](https://www.nerdfonts.com/))

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bepadxop2ygm1knsn284.png)

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

![Terminal Settings](https://dev-to-uploads.s3.amazonaws.com/i/w09vyqmaupmipvd92h6c.png)

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

![Settings](https://dev-to-uploads.s3.amazonaws.com/i/k14ionb2nwa1micvpy7d.png)

If you want to have a look at my full settings, [here](https://gist.github.com/shettykaran21/ab3d5cba710bae43a26739fd9d9e934d) it is.
For all the available settings in the terminal, refer the [official docs](https://docs.microsoft.com/en-us/windows/terminal/customize-settings/profile-settings).

### Install Powerline fonts
- Run the following command:
```
sudo apt install fonts-powerline
```
This must install powerline fonts so that weird symbols don't appear in the terminal.
(You can also install one of [Nerd Fonts](https://github.com/ryanoasis/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
```

- 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](https://dev-to-uploads.s3.amazonaws.com/i/yvihdf82tg415u723n9n.png)

- 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](https://github.com/romkatv/powerlevel10k) for more info.

**Done!! Your terminal must look similar to this:**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/j9zf4i6iakz7qrqiybgo.png)


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