Making shell more beautiful

As soon as we make transition from Mac/Linux based operating system to Windows OS, the first thing we miss is the shell. As Macbook users / developers we are accustomed to running commands instead of using GUI, we would have learnt a lot of things that we cannot unlearn quickly. Fortunately , there is one simple approach to bring up shell with in Ubuntu and use Zsh for anything that requires a shell .

Installing WSL 2

Install WSL 2 following instructions provided in the Microsoft website. Windows Sub System for Linux provides environment to run GNU/Linux environment , command line tools , utilities directly on Windows without installing a VM or dual boot . This has to be installed before we can proceed further .

Installing Windows Terminal

Terminal is an open source project by Microsoft which offers a lot of good features that make our job easy . This application does not come pre-installed, we have to get it from Microsoft Store .

  1. Open the Microsoft Store, go to search and type “Windows Terminal. Click on the Windows Terminal app.

2. Click on the Install button for installation to start .

Microsoft’s recommended way to install Windows Terminal is through Microsoft Store . Once the application is installed, we can open it by clicking launch button .

This installation will also add Windows Terminal to context menu. We can open terminal from any folder just by doing a right click and selecting Terminal.

Unlike the default shell, we will have options to customize the font, background and opacity. We can do this by going to the settings menu which is located just beside the close button of the tab .

A couple of releases ago, the configuration was being maintained in a json file. To make things easy , Microsoft has replaced it with GUI menu. We can change the settings confidently without fiddling with the json . We will come back to this part later in the post .

Installing Ubuntu 20.04

We can install Ubuntu in a few minutes from Microsoft Store where it can be found easily .

This step takes a couple of minutes. Ubuntu will get installed , when we run it for the first time we will be prompted for setting up a username and password .

If we open Terminal and see , we will find an additional shell along with the existing ones .

Now we are brought to the Windows user home . Our Windows file system is accessible from /mnt/c/.

Installing ZSH

Zsh is a shell that provide a good set of features that are borrowed from other shells like bashksh, and tcsh. Since we will be firing commands this does not matter . If we are planning to write and execute shell scripts , we should use bash/ksh/tcsh for this purpose . Installation can be done by the following commands .

sudo apt update

sudo apt install zsh

Setting up the fonts

The fonts that Zsh show contain special symbols, for which we have to download additional fonts from this website https://www.nerdfonts.com/.

Go to download section in the website, download the font we like from the list of fonts available .

Once we download the zip file , we extract it and install all the fonts which are inside the extracted folder .

Go to settings > profiles > Ubuntu 20.04 > Appearance > Change the font face to the font you have installed earlier .


Setting up zsh

We tweak some settings before we can use ZSH. There is a framework called oh-my-zsh which will assist in configuration . This can be done by the following command :

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


Once we see the prompt “->” we are done setting up .

Installing theme

Now it is time for us to install a theme which we like. For the purpose of this illustration I am using Powerlevel10k. We will get a series of options to select the settings. We have to key in Yes / No / Quit or 1,2,3 accordingly .

Configuring Plugins

In ZSH we can enable some plugins which will help our day to day tasks . This can be done by editing the .zshrc file .

We can experiment with the appearance of the shell by modifying various options that are provided in the settings menu.

In the end, we will get a Terminal which is much better than the default command prompt / PowerShell. There is no limit to the customizations that we can do with zsh.

srnyapathi
srnyapathi
Articles: 41