Windows Terminal – Installation and configuration: full tutorial

windows terminal screenshot

Windows Terminal is the new terminal application for command line users provided (free) by Microsoft. This includes the most requested features by users of Windows commandline tools, such as tabs, rich text, globalization, advanced configuration capabilities, interface themes and styles, and more. This tutorial details the installation and the configuration of the Windows Terminal. All examples are accompanied by the corresponding source files to be downloaded from this site.

Here’s an example of the result we’ll get:

Windows Terminal en action

To the summary of this tutorial:

  • 1. Installing Windows Terminal
  • 2. Personalization of appearance
    • 2.1. Profile.json file organization
    • 2.2. Settings by default
    • 2.3. Settings by profiles
  • 3. Adding Linux shells for the Windows subsystem for Linux (WSL)
    • 3.1. Adding Ubuntu (18.04.LTS)
  • 4. Adding shells useful to the developer
    • 4.1 Bash Git
    • 4.2. Visual Studio 2019 command line
  • 5. Useful information and resources
    • 5.1. Get multiple shells in the same window
    • 5.2. Default keyboard shortcuts
    • 5.3. Files of resources used in this tutorial
    • 5.4. Useful links

1. Installation of Windows Terminal

First, you need to check that your OS/machine is following the requirements: (to know your version you can enter ver in the Windows 10 search bar)

  • OS: Windows 10 version 18362.0 or higher (v1903-Build 10.0.18362.0)
  • architecture ARM64, x64, x86

To get the software, the easiest and fastest is to download it from Windows App Store: https://www.microsoft.com/fr-fr/p/windows-terminal-preview/9n0dx20hk701?activetab=pivot:overviewtab

Microsoft app store
download from the store

And as this tool is a Microsoft Open Source project! you can also get it from GitHub at: https://github.com/Microsoft/Terminal
In this case the requirements are increased with the necessary tools and libraries. Envisage:

  • Visual Studio 2017 or 2019 with the Windows 10 SDK version 1903 (minimum)
  • C++ Desktop Development package
  • Universal Windows Platform Development (the terminal is an UWP app)
  • Toolset v141 and Visual C++ ATL for x86 and x64 (only Visual Studio 2019)
  • ‘developer’ mode must be enabled in Windows 10

I will not discuss the compilation in this post.

Once the download is complete, you can launch the app. By default, the interface is neutral but is just waiting to be customized. At the opening, the default shell is powerShell is activated:

Windows PowerShell
Windows PowerShell

Access to shells and settings is made from the [V] button. The button [+] opens the default shell in a new tab. Initially, the terminal incorporates the configuration of the Shells PowerShellcmd (the original shell of MSDos) and Azure Cloud Shell:

shells intégrés par défaut
shells integrated by default

2. Personalization of appearance

The settings are described in a JSon syntax file. They can be accessed from the [V] button, item “settings”. A click on this item causes the JSon file to be opened in your default JSon text editor. It is best to use a JSon-compatible editor, I recommend for this Visual Studio Code, in order to benefit from the support of the scheme and therefore the intelliSense automatic completion. The schema is available at this address: https://aka.ms/terminal-profiles-schema

As the terminal is a UWP application, its data is deployed in the user’s AppData. The full path of the settings file is here:
%USERPROFILE%-AppData-Local-Packages-Microsoft.WindowsTerminal_8wekyb3d8bbwe-LocalState-profiles.json For the same reason, it is recommended that the data files used by settings be placed in the ms-appdata:///roaming/ (i.e. /USERPROFILE%-AppData-Roaming) directory to keep files linked to the Microsoft account (if enabled) and roaming them or ms-appdata:///local/, but this will also work if the files are placed in another path. Windows Terminal applies settings every time the file is saved in the text editor.

2.1. Profile.json file organization

The file contains 3 main sections:

  • at the root of the file, settings regarding the overall behavior of windows terminal. the most important settings being:
    • defaultProfile: indicates the GUID of the default active profile (profiles, resp. shells are identified by a GUID)
    • initialCols , initialRows: initial window size
  • profiles: In this section are described the parameters of the shells:
  • profiles > defaults : section that receives the default customization of the windows terminal
VSCode Windows Terminal settings
VSCode Windows Terminal settings
  • list profiles > list: list of shells available and shell over-ching of customization
  • schemes: receives customization of color themes
  • keybindings: key assignment settings

2.2. Default Settings

In the defaults section the settings are placed to customize the terminal regardless of the open shell. We can change the customization for each shell in the entries of the section list. Here is a complete example of the settings that are available with a description of their values:

name of setting Type description/example
Colorscheme String color theme among one of the themes predefined
possible values: “Campbell,” “One Half Dark,” “One Half Light,” “Solarized Dark,” “Solarized Light” “colorScheme”:
“Campbell”
useAcrylic Boolean indicates whether the window background uses the ‘acrylic’ brush of windows 10
‘useAcrylic’: true
acrylicOpacity float between 0 and 1 (included) opacity of acrylic background (if activated)
“acrylicOpacity”: 0.1
background String color of acrylic brush (if activated)
“background”: “#012456”
Backgroundimage String path of a background image
“ms-appdata:///local/84314.jpg”
backgroundImageOpacity float between 0 and 1 (included) opacity of the background image (when the terminal window is active)
“backgroundImageOpacity”: 1
backgroundImageStretchMode String
how the image is adjusted to occupy the bottom of the window. value among “uniformToFill,” “fill,” “none,” “uniform” “backgroundImageStretchMode”: “uniformToFill”
backgroundImageAlignment String positioning the background image. value among “center,” “bottom,” “bottomLeft,” “bottomRight,” “center,” “left,” “right,” “top,” “topLeft,” “topRight” “backgroundImageAlignment”:
“center”
cursorColor String “cursorColor” cursor color: “#88FF00”
cursorShape String shape of the cursor. value among: “vintage” ( ▃ ), “bar” ( ┃ ), “underscore” ( ▁ ), “filledBox” ( █ ), “emptyBox” ( ▯ )
‘cursorShape’: ‘filledBox’: ‘filledBox’
cursorHeight Integer cursor height (only for ‘vintage’ cursor). between 25 to 100 included
doFace String name of the cast
Fontsize Float font size
closeOnExit Boolean indicates how the terminal will be closed following a closure request event:

  • “graceful” (or true,by default): closure if ‘exit’ is typed or when the process normally ends
  • “always”: always close
  • “never” (or false):never close “closeOnExit”: “false”
historySize Integer numbers of lines in the buffer (which can be seen by scrolling over the input line). default 9001, minimum -1
startingDirectory String default path to opening a shell.
“startingDirectory”: “%USERPROFILE%”
padding String width of the inner frame of the text window of the terminal
“padding” terminal: “4,4,4,4”
snapOnInput Boolean if true, the text window is scrolled across the input line when a keystroke is done
“snapOnInput”: true
tabTitle String if true, replaces the “name” for the title to be transmited to the shell when starting. Some shells ignore this value (bash) while others accept it (cmd,powershell)
suppressApplicationTitle Boolean If true, tabTitle replaces the tab’s default title and each application title change request will be ignored
alwaysShowTabs Boolean If true, the tabs are displayed all the time. otherwise and if showTabsInTitleBar is not enabled then the tabs will only appear after opening a new tab. or you have to press Ctrl-Tab to see them
ShowInTitlebar Boolean if true, the tabs are moved into the title bar and the tab bar disappears

After changing these settings, the appearance of the terminal will look like the screen copy that is shown at the beginning of the post… (find all the needed files at the end of this page)

2.3. Settings by profiles

A set of settings is stored in a profile, stored in the profiles > list section. Initially, each built-in shell has its own profile. Each profile can be uniquely identified by a GUID. The default profile (“defaults”) allows to specify default settings for all profiles, which can be overloaded for each profile in its respective sections. Thus initially we have the following entries corresponding to the 3 integrated shells:

{
// powershell.exe profile
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
// cmd.exe profile
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd",
"commandline": "cmd.exe",
"hidden": false
},
{
// azure cloud shell profile
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
}

Profiles listed here appear in the menu [V] if the hidden attribute does not have true value. This section will be used to individually add and configure shells added to the terminal.

3. Adding Linux shells for the Windows subsystem for Linux (WSL)

The Windows subsystem for Linux allows you to run a GNU/Linux environment (including most online control utilities, apps and tools) directly on Windows (from Windows 10 Fall Creators Update and later (build Windows 16215 or later)), without modification and while avoiding the overload of a virtual machine. This allows to:

  1. Choose your favorite GNU/Linux distributions from the Microsoft Store
  2. Run free current online ordering software such as grep, sed and awk or other ELF-64 binary files
  3. Run Bash shell scripts and online GNU/Linux command applications, including:
    • Tools: vim, emacs, tmux
    • Languages: Javascript/node.js, Ruby, Python, C/C++, C#, Rust, Go, etc.
    • Services: SSHD, MySQL, Apache, lighttpd
  4. Install additional software using your own GNU/Linux distribution package manager
  5. Call Windows apps using a UNIX command line shell
  6. Call GNU/Linux apps on Windows

The first thing to do in order to be able to integrate linux shells (bash,..) into the Windows Terminal is to install WSL. To do this, you need to enable the optional WSL feature in Windows. Open PowerShell as an administrator and run:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

installing WSL
installing WSL

Restart the computer when you are invited to.

Now it is possible to install a Linux distribution from the App Store in Windows (Windows build 1615 required). You can choose from the store the distribution of your choice in the following list :

Name Url
 Ubuntu 16.04 LTS  https://www.microsoft.com/store/apps/9pjn388hp8c9
 Ubuntu 18.04 LTS  https://www.microsoft.com/store/apps/9N9TNGVNDL3Q
Leap OpenSUSE 15  https://www.microsoft.com/store/apps/9n1tb6fpvj8c
Leap OpenSUSE 42  https://www.microsoft.com/store/apps/9njvjts82tjx
 SUSE Linux Enterprise Server 12  https://www.microsoft.com/store/apps/9p32mwbh6cns
 SUSE Linux Enterprise Server 15  https://www.microsoft.com/store/apps/9pmw35d7fnlx
 Kali Linux  https://www.microsoft.com/store/apps/9PKR34TNCV07
 Debian GNU/Linux  https://www.microsoft.com/store/apps/9MSVKQC78PK6
Fedora Remix for WSL  https://www.microsoft.com/store/apps/9n6gdm4k2hnc
 Pengwin  https://www.microsoft.com/store/apps/9NV1GV1PXZ6P
 Pengwin Enterprise  https://www.microsoft.com/store/apps/9N8LP0X93VCP
 Alpine WSL  https://www.microsoft.com/store/apps/9p804crf0395

3.1. Adding Ubuntu (18.04.LTS)

From the store, download the Ubuntu distribution (https://www.microsoft.com/store/apps/9N9TNGVNDL3Q) and launch the downloaded app. The first launch results in the decompression and deployment of files.

In the shell that then opens (a WSL shell “bash” has already been installed automatically at windows terminal), you are now invited to create a user account in the Linux:

initialization of Ubuntu Linux in windows terminal
initialization of Ubuntu Linux in windows terminal

Long as one is in the bash of Ubuntu, we will generate a GUID for our future configuration in Windows Terminal, using the command: uuidgen. Note the code obtained we will use it later.

Now we’re just going to add an entry in
profiles>list de profiles.json as follows:

// Ubuntu 18.04 LTS
{
// indiquez ici votre GUID obtenu avec uuidgen
"guid": "{ff649c13-a1a0-44c6-84b4-0e3a5a23b0d6}",
"hidden": false,
"name": "Ubuntu 18.04 LTS",
// indiquez ici votre chemin vers l'icone (fourni en fin de page)
"icon": "C:/Users/franc/Pictures/Icones/iconfinder_OS_Ubuntu_99950.ico",
"commandline": "wsl -d Ubuntu-18.04"
},

The comand line invokes the wsl tool. Tip: To know the list of linux distribution identifiers installed launch the wsl-l command in your favorite shell.

4. Adding shells usefull to the developer

4.1 Bash Git

Requirements: Git on Windows must be installed. If necessary, download and install it from https://git-scm.com/downloads. The default options are perfectly suitable for use in Windows Terminal.

We can then add the following entry in profiles > list of Windows Terminal profiles.json (a guide was
generated as seen above to identify the profile/shell):

// Git Bash
{
"name" : "Git Bash 2.26.0",
"guid": "{5822e4e8-056e-4ce6-bafb-0d36360df0c4}",
// adapter le path
"icon": "C:/Users/franc/Pictures/Icones/git.ico",
// adapter la ligne de commande si nécessaire
"commandline": "c:/Program Files/Git/bin/bash.exe",
"startingDirectory" : "%USERPROFILE%"
},

4.2. Visual Studio 2019 command line

Obviously this concerns those of you who have already installed Visual Studio 2019. The input to add will simply be as follows (with the need to adapt the paths according to your version of Visual Studio, in this case it is ‘Community’):

// Visual Studio 2019 cmd line
{
"name" : "Visual Studio 2019 cmd",
"icon": "C:/Users/franc/Pictures/Icones/iconfinder_Visual_Studio_1082427.ico",
"commandline" : "cmd.exe /k \"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools/VsDevCmd.bat\"",
"startingDirectory" : "%USERPROFILE%"
}

5. Useful information and resources

5.1. Get multiple shells in the same window

It is possible to split the view of a shell (the active tab) into several panels, and thus obtain several command lines. The new panel receives the shell by default. For this just use the keyboard shortcuts that are set by default:

  • alt+shift+ – split the panel running horizontally
  • alt+shift+plus: splits the current panel vertically

But how do you get different shells in the same window (which means grouping different tabs in splits panes of a single tab at the start) ?

==> This is possible by launching the Windows Terminal via a command line.
The syntax given here is valid from the Cmd shell inside the terminal or inside a .bat file

  • the executable is wt
  • The magic option of wt is split-pane:
    • -p to indicate the GUID or the wording of the shell (the one that would appear in the menu [V])
    • -H to indicate a horizontal split
    • V to indicate a vertical split

for example:Windows PowerShell – Ubuntu – Cmd in the same window:

wt ; split-pane -p "Ubuntu 18.04 LTS" ; split-pane -H Cmd

multi shell
multi shell

5.2. Default keyboard shortcuts

Find here the list of pre-defined keyboard shortcuts. You can change these definitions in the keybindings section

key assignments Action
ctrl+shift closes the current panel
alt+f4 closes the terminal window
ctrl+shift+c copy the current selection
ctrl+insert copy the current selection
ctrl+- decreases the size of the font
ctrl+shift+d duplicates the current tab
ctrl+= increases the size of the font
alt+down moves the focus to the below panel
alt+left moves the focus to the left panel
alt+right moves the focus to the right panel
alt+up moves the focus to the above panel
ctrl+shift+t opens a new tab with the default shell
ctrl+shift+1 to ctrl+shift+9 opens a new tab with the shell having the index corresponding to the number pressed
ctrl+tab switches to the next tab
ctrl+shift+space opens the selection menu ([V]) of a shell for opening new tab
ctrl+, opens the settings file
ctrl+shift+v paste
shift+insert paste
ctrl+shift+tab switches to the previous tab
ctrl+0 resets the size of the font
alt+shift+down resize the current panel
alt+shift+left resize the current panel
alt+shift+right resize the current panel
alt+shift+up resize the current panel
ctrl+shift+down scroll down
ctrl+shift+pgdn scroll one page down
ctrl+shift+up scroll up
ctrl+shift+pgup scroll one page up
alt+shift+- splits the current panel horizontally
alt+shift+plus splits the current panel vertically
ctrl+alt+1 to ctrl+alt+9 switch to the tab of index corresponding to the pressed number
ctrl+shift Research
alt+enter switches window/full-screen mode
f11 switches window/full-screen mode

5.3. Files of resources used in this tutorial

5.4. Useful links


To follow: In a future post we’ll see how to set a theme for the prompt in the Windows Terminal with among other things a font with advanced glyphs (powerline)

Leave a Reply