Getting started with Windows New Terminal + WSL (Windows Subsystem for Linux)

Bhavkaran Chahal
8 min readAug 13, 2019

I am starting a series of writeups for enhancing various skills in Infosec. This is my first writeup on Medium. Before this, I wrote one blog on Pewdiepie Printer Hack Case Study which became viral after the same hacker retweeted my case study and got thousands of views.

In this writeup, I am customizing windows open-source new terminal and replacing damn slow Virtual Machines with this powerful WSL (Windows Subsystem for Linux).

Content in this Writeup

  1. Steps to turn on WSL
  2. Installing Windows Terminal
  3. Understanding Settings of Windows Terminal
  4. Terms to remember
  5. Customizing the Terminal
  6. Setting up the default Profile
  7. Increasing transparency and changing font size
  8. Change Padding
  9. Changing the icon of Linux distro
  10. Changing Font Styles
  11. Change Default Key Bindings
  12. Color Schemes
  13. Profiles Examples
Before and after customization of windows new terminal

I love to work on terminals, especially it gives superpowers to control the whole system from just one place.

I tried to install Debian, Elementary, Ubuntu and other distributions of Linux too. But the problem with Linux is it does not support Tobii Eye Tracking (Face Unlock), Alienware Command Centre, RGB Lights Customization, External Graphics Amplifier, and other many cool features too in Gaming Laptops.

Windows Operating system gives the best hardware and software integration with my Alienware and other Gaming laptops in contrast to Linux. I spent around 2 lakhs but after using Linux I can’t even feel the power of my Machine.

So, I re-installed Windows 10 with a new May update. I noticed Windows Terminal’s new pre-release update with a lot of improvements and decided to try that out.

As of today, the Windows Terminal and Windows Console have been made open source and you can clone, build, run, and test the code from the repository on GitHub:

https://github.com/Microsoft/Terminal

After playing around with terminal for 7 days I decided to make a writeup so it will help you guys to set up and customize your terminal.

Steps to turn on WSL

Follow these steps to turn on WSL (Windows Subsystem for Linux). If you have already enabled you can skip this step.

Step 1: Open Control Panel > Programs > Programs and Features > Turn Windows features on or off > Tick on Windows Subsystem for Linux.

Step 2: Click OK to apply the changes you made. Windows will install WSL and Reboot the operating system when prompted.

Step 3: Open Windows Store and search for Linux and Install any distro you want to install. In my case is installed Ubuntu 18.04 LTS.

Installing Windows Terminal

Minimum System Requirements: Windows 10 version 18362.0 or higher

Just open Windows Store > Search for “Terminal” click on Install Button.

After installing click on Launch and you’ll see terminal like this.

Understanding Settings of Windows Terminal.

Click on + icon next to the opened tab and click Settings.

As you can see, the settings automatically opened in JSON format file named profiles.json in my default code editor. You can also download and install this free open source Visual Studio Code editor by Microsoft.

As we are working on WSL you can install this Remote — WSL extension (recommended) to Code editor which lets you use the Windows Subsystem for Linux (WSL) as your full-time development environment right from VS Code.

Open Marketplace by pressing Ctrl + Shift + X keys on your keyboard and paste @id:ms-vscode-remote.remote-wsl in the search and click install.

Now switch back to profile.json tab and let’s understand what’s happening inside that mess. Believe me, after reading this whole writeup you’ll understand each and everything in this code. 😉

Scroll down to “profiles” on line 226 (the line can differ in your case)

Terms to remember

“acrylicOpacity” is the blur which is applied to your terminal’s background.“background” changes the background color of the terminal.“closeOnExit” automatically closes the terminal when the process exits.“colorScheme” is provided by terminal to colorize your code.“commandline” sets a custom command-line interface when you click on tabs.“cursorColor” changes the color of the cursor.“cursorShape” changes the shape of the cursor into a block, line, etc.“fontFace” changes the font style of your terminal.“fontSize” changes the font size.“guid” is a Globally Unique Identifier which will be later used to set different Linux distros as default tab when you open terminal.“icon” is used to set your favorite icon for a custom profile.“name” can be anything you want. It’ll show on the title bar and other places.“padding” is used to give a clean look and add spaces around the terminal.“useAcrylic” is used to toggle ON or OFF this feature for better customization.

Customizing the terminal

Create a new profile by copying this code after “profiles” code on line 226 of profiles.json (Windows Terminal Settings)

After pasting, the code will look like this:

and you’ll see a new profile added to your terminal now.

After clicking on the new profile the terminal will look like this :

WSL running on windows terminal

Still many things missing, let’s change.

Setting up the default Profile

Every time you open the Windows Terminal, It’ll open the profile you want to set instead of Powershell.

Copy this line from profiles.json (Terminal Settings)

"guid" : "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",

and paste the code after “defaultProfile” and it’ll look like this:

"defaultProfile" : "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",

Increasing transparency and changing font size

You can also change the settings according to you. I used these settings.

"useAcrylic": true,
"acrylicOpacity" : 0.3,
"fontSize" : 13,

and terminal looks like this.

Change Padding

Text looks sticky to the sides which doesn’t feel good. Let’s try to add 25px padding to all sides.

"padding": "25, 25, 25, 25",

after applying the padding the terminal will look like this:

Changing the icon of Linux distro

I am using Ubuntu so, I’ll add ubuntu icon but you can set any icon you want.

Go to this directory and paste the 32 x 32 transparent png icon.

C:\Users\Username\AppData\Local\Packages\Microsoft.WindowsTerminal_xxxxxxxxxxxxx\RoamingState

After placing the icon, open profiles.json and change this line:

"icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",

To this:

"icon" : "ms-appdata:///roaming/filename.png",

and the icon will appear on the terminal:

Changing Font Styles

You can also change the Font Styles by changing the font name:

"fontFace" : "Consolas",

Change Default Key Bindings

The first section contains key bindings if you don’t like a particular keyboard shortcut you can change those here. For instance, if you want ctrl+shift+w to close the tab you would find this section:

You can customize the key bindings of your choice.

Color Schemes

At the end of the profiles.json file, you can find a section called “schemes”.
From here you can add or change the default colors of your terminal.

If you want to use it in your new profile, you have to insert the same scheme name in the property “name” and in the “colorScheme” property for the profile section.

Profiles Examples

Here are some custom profiles you would like. Feel free to post the link of your profiles in the comment section below. 😉

  1. Unicorn

Code:

{"acrylicOpacity" : 0.85000002384185791,"background" : "#012456","backgroundImage" : "ms-appdata:///roaming/unicorn.gif","backgroundImageOpacity" : 0.69999998807907104,"backgroundImageStretchMode" : "uniformToFill","closeOnExit" : false,"colorScheme" : "Campbell","commandline" : "wsl ~","cursorColor" : "#00FF00","cursorHeight" : 25,"cursorShape" : "vintage","fontFace" : "Fira Code","fontSize" : 13,"guid" : "{79285a8e-036c-446f-8a9c-78994e34bf78}","historySize" : 9001,"icon" : "ms-appdata:///roaming/ubuntu_32px.png","name" : "Terminal with Unicorn","padding" : "25, 25, 25, 25","snapOnInput" : true,"startingDirectory" : "%USERPROFILE%","useAcrylic" : false},

Background image:

2. Star Wars

Code:

{"acrylicOpacity" : 0.85000002384185791,"background" : "#012456","backgroundImage" : "ms-appdata:///roaming/lukeboba.gif","backgroundImageOpacity" : 0.69999998807907104,"backgroundImageStretchMode" : "uniformToFill","closeOnExit" : false,"colorScheme" : "Starwars","commandline" : "wsl ~","cursorColor" : "#00FF00","cursorHeight" : 25,"cursorShape" : "vintage","fontFace" : "Campbell","fontSize" : 13,"guid" : "{79285a8e-036c-446f-8a9c-78994e34bf76}","historySize" : 9001,"icon" : "ms-appdata:///roaming/ubuntu_32px.png","name" : "Terminal Star Wars","padding" : "25, 25, 25, 25","snapOnInput" : true,"startingDirectory" : "%USERPROFILE%","useAcrylic" : false},

Color Scheme:

{"background" : "#0C0C0C","black" : "#0C0C0C","blue" : "#0037DA","brightBlack" : "#767676","brightBlue" : "#3B78FF","brightCyan" : "#61D6D6","brightGreen" : "#16C60C","brightPurple" : "#B4009E","brightRed" : "#E74856","brightWhite" : "#F2F2F2","brightYellow" : "#F9F1A5","cyan" : "#3A96DD","foreground" : "#0C0C0C","green" : "#13A10E","name" : "Starwars","purple" : "#881798","red" : "#C50F1F","white" : "#CCCCCC","yellow" : "#C19C00"}

Background image:

3. Tardis

Code:

{"acrylicOpacity" : 0.85000002384185791,"background" : "#012456","backgroundImage" : "ms-appdata:///roaming/tardis.gif","backgroundImageOpacity" : 0.69999998807907104,"backgroundImageStretchMode" : "uniformToFill","closeOnExit" : false,"colorScheme" : "Campbell","commandline" : "wsl ~","cursorColor" : "#00FF00","cursorHeight" : 25,"cursorShape" : "vintage","fontFace" : "Fira Code","fontSize" : 13,"guid" : "{79285a8e-036c-446f-8a9c-78994e34bf75}","historySize" : 9001,"icon" : "ms-appdata:///roaming/ubuntu_32px.png","name" : "Terminal Tardis","padding" : "25, 25, 25, 25","snapOnInput" : true,"startingDirectory" : "%USERPROFILE%","useAcrylic" : false}

Background image:

On next writeup, I’ll show you how to use infosec tools made by best researchers for Bug Bounty and how to create custom aliases to speed up your bug hunting and hacking skills.

Gif profile Credit: https://dev.to/kasuken

Give a clap👏 if you like my work 😎

--

--

Bhavkaran Chahal

Senior Security Engineer at Manulife | OSCP | CRTP | eCXD | eCPPT | CEH