In this article, we’ll explore Windows Terminal, the ideal accompaniment to WSL2. It’s fast, configurable, looks great, and offers all the benefits of both Windows and Linux development.
Windows has fully embraced Linux, and WSL2 makes it a seamless pleasure.
Your distro’s terminal can be accessed by:
- clicking its Start menu icon
- entering
wsl
orbash
at a Powershell or command prompt - using a third-party terminal option such as Cmder, ConEmu, and Hyper with a profile which launches
%windir%\system32\bash.exe ~
- setting Linux as the default shell in VS Code by pressing Ctrl + Shift + P and typing/choosing Terminal: Select Default Shell, and selecting WSL Bash.
Windows Terminal (downloadable from the Microsoft Store) offers a further choice, but you won’t regret installing it. The new application features:
- support for WSL2, SSH, Powershell, cmd and other command lines
- multiple tabs and split panes
- configurable themes, background images, and transparency effects
- a search box
- custom key bindings
- GPU accelerated text rendering
- a great-looking new font, Cascadia Code
- low resource usage (typically 10MB per tab)
- auto-updating (if using the Microsoft Store)
- good documentation
- and it’s open source!
How to Install Windows Terminal
The easiest way to install Windows Terminal is via the Microsoft Store:
ms-windows-store://pdp/?ProductId=9n0dx20hk701
If this link fails, try opening the Microsoft Store in your browser or launching the Microsoft Store app from the Windows Start menu and searching for “Terminal”.
Note: be careful not to select the earlier “Windows Terminal Preview” application.
Hit Get and wait a few seconds for installation to complete.
If you don’t have access to the Store, you can download the latest release from GitHub.
The Windows Terminal app icon is now available in the Windows Start menu. For easier access, right-click the icon and choose Pin to Start or More, followed by Pin to taskbar.
Getting Started with Windows Terminal
When it’s first run, Windows Terminal starts with Powershell as the default profile. A drop-down menu is available to launch other tabs and access the settings:
Terminal automatically generates profiles for all WSL distros and Windows shells you have installed, although it’s possible to disable generation in the global settings.
Managing Tabs and Panes
Open a new tab for the default profile by clicking the + icon or Ctrl + Shift + T. To open a tab for a different profile, choose it from the drop-down menu or press Ctrl + Shift + N, where N is the profile’s number.
Press Alt + Shift + D to duplicate and split the pane. The active pane is split in two along the longest axis each time it is used:
To force creation of a:
- vertical pane, press Alt + Shift + +, or
- horizontal pane, press Alt + Shift + -
To open another profile in a new pane, hold down the Alt key when choosing it from the drop-down menu.
Hold down Alt and use the cursor keys to switch between active panes from the keyboard. The size of a pane can be adjusted by holding Alt + Shift and using the cursor keys to resize accordingly.
Tabs can be renamed by double-clicking the text. You can also change the name or color by right-clicking the tab and choosing a menu option:
This only affects the current tab; it doesn’t permanently change the profile.
To close the active pane or tab, press Alt + Shift + W or enter the terminal’s standard exit command (usually exit).
Text size
The text size of the active terminal can be resized with Ctrl + + and Ctrl + -. Alternatively, hold down Ctrl and scroll the mouse wheel.
Scrolling
Use the scroll bar to navigate through the terminal output. Alternatively, hold down Ctrl and press cursor up, cursor down, Page Up or Page Down to navigate using the keyboard.
Search
Press Ctrl + Shift + F to open the search box:
Enter any term then use the up and down icons to search the terminal output. Click the Aa icon to activate and deactivate exact-case matching.
Copy and Paste
By default, copy and paste are bound to Ctrl + Shift + C and Ctrl + Shift + V respectively, although Ctrl + C and Ctrl + V will also work.
Note: be wary that Ctrl + C can terminate a Linux application, so using Shift is advisable.
An automatic copy-on-select option is available in the global settings, and you can also paste the current clipboard item by right-clicking the mouse.
Settings
Settings are accessed from the drop-down menu or Ctrl + , (comma). The configuration is defined in a single settings.json
file, so you may be prompted to choose a text editor. VS Code is a great choice, although Notepad is fine if you’re happy to edit without color-coding and syntax checking.
settings.json
controls:
- global settings, which apply to all profiles
- profile settings, which define profiles
- custom color scheme settings, and
- keybinding settings
The file uses the following format:
// This file was initially generated by Windows Terminal
{
// general settings, e.g.
"initialRows": 40,
// profile settings
"profiles":
{
"defaults":
{
// settings that apply to all profiles
}
"list":
[
// list of individual profiles, e.g.
{
"guid": "{81d1dceb-c123-5678-90a1-123abc456def}",
"name": "Windows PowerShell",
"commandline": "powershell.exe"
},
{
"guid": "{91d1dceb-c123-5678-90a1-123abc456def}",
"name": "Ubuntu",
"source": "Windows.Terminal.Wsl"
}
]
}
// custom color schemes, e.g.
"schemes": [
{
"name": "My new theme",
"cursorColor": "#FFFFFF",
"selectionBackground": "#FFFFFF",
"background" : "#0C0C0C",
"foreground" : "#CCCCCC"
}
],
// custom key bindings, e.g.
"keybindings:
[
{ "command": "find", "keys": "ctrl+shift+f" }
]
}
Defaults are defined in defaults.json
. Open it by holding down Alt when clicking Settings in the drop-down menu.
Warning: do not change the defaults file! Use it to view default settings and, where necessary, add or change a setting in settings.json
.
Global Settings
The following global settings are the most useful, although more are documented in the Terminal documentation.
"defaultProfile"
defines the GUID of the profile used as the default when Windows Terminal is launched.
Set "copyOnSelect"
to true
to automatically copy selected text to your clipboard without having to press Ctrl + Shift + C.
Set "copyFormatting"
to false
to just copy plain text without any styling. (I wish this were the default for every application everywhere!)
Set "initialColumns"
and "initialRows"
to the number of characters for the horizontal and vertical dimensions.
"tabWidthMode"
can be set to:
"equal"
: each tab is the same width (the default)"titleLength"
: each tab is set to the width of its title, or"compact"
: inactive tabs shrink to the width of their icon.
"disabledProfileSources"
sets an array which prevents profiles being automatically generated. For example:
"disabledProfileSources": [
"Windows.Terminal.Wsl",
"Windows.Terminal.Azure",
"Windows.Terminal.PowershellCore"
],
This would disable all generated profiles; remove whichever ones you want to retain.
Profile Settings
New profiles are defined by creating an object group in the "profiles"
, "list"
array. A WSL2 Ubuntu example:
{
"guid": "{91d1dceb-c123-5678-90a1-123abc456def}",
"name": "Ubuntu",
"source": "Windows.Terminal.Wsl",
"startingDirectory": "//wsl$/Ubuntu/home/username/",
"colorScheme": "Tango Dark",
"useAcrylic": true,
"acrylicOpacity": 0.75,
"hidden": false
},
Each profiles is defined with the following settings:
setting | description |
---|---|
"guid" |
a unique identifier (required). For new profiles, you can generate a GUID online at guidgen.com |
"source" |
the profile generator. This is only used when a profile has been automatically added and must not be edited. |
"commandline" |
the executable to run assuming no "source" is set. For example, this could be an SSH command such as "ssh yourname@domain.com" |
"startingDirectory" |
the directory the shell starts in. For WSL distros, this is best set to "//wsl$/Ubuntu/home/username/" where username is the user created during installation |
"name" |
the profile name shown in the drop-down menu |
"tabTitle" |
the name shown in the tab title |
"suppressApplicationTitle" |
set true to force the "tabTitle" or "name" in bash |
"icon" |
the full path to the icon shown in the drop-down and tab, e.g. "C:/images/tux.png" . 24-bit PNGs are the best option; unfortunately, SVGs are not supported |
"hidden" |
if set true , the profile is not displayed in the drop-down menu |
"fontFace" |
use a specific font |
"fontSize" |
use a specific font point size integer |
"fontWeight" |
use a specific font weight. This can be an OpenType integer or a keyword: "normal" , "thin" , "extra-light" , "light" , "semi-light" , "medium" , "semi-bold" , "bold" , "extra-bold" , "black" , "extra-black" |
"padding" |
padding around text at the edge of the window. One, two, or four comma-delimited values can be set, e.g. "1, 2, 3, 4" to set left, top, right, and bottom respectively |
"antialiasingMode" |
the anti-aliasing method. Set to "grayscale" (the default), "cleartype" , or "aliased" |
"cursorShape" |
the cursor type. Set to "bar" (the default), "vintage" , "underscore" , "filledBox" , or "emptyBox" |
"cursorHeight" |
the height of a "vintage" cursor defined as an integer between 25 and 100 |
"cursorColor" |
the cursor color, defined as "#rgb" or "#rrggbb" |
Theme-specific settings include:
setting | description |
---|---|
"colorScheme" |
the name of a color scheme as defined in defaults.json or the "schemes" list in settings.json (see below) |
"useAcrylic" |
set true to use a frosted-glass background effect |
"acrylicOpacity" |
the acrylic opacity from 0 (fully transparent) to 1 (fully opaque) |
"backgroundImage" |
the full path to a background image, e.g. "C:/images/background.png" |
"backgroundImageOpacity" |
the background image opacity from 0 (fully transparent) to 1 (fully opaque) |
Finally, add "experimental.retroTerminalEffect": true
to a profile for a retro CRT effect!…
Color Scheme Settings
Each profile’s "colorScheme"
can be set to the name of any color scheme included in defaults.json
. For example:
"Campbell"
:
"Campbell Powershell"
:
"One Half Dark"
:
"One Half Light"
:
"Tango Dark"
:
"Tango Light"
:
"Vintage"
:
Create Your Own Color Scheme
Your own scheme objects can be defined in the "schemes"
array in settings.json
. Each color is defined with a hex value. For example:
"schemes": [
{
"name": "My New Theme",
"foreground": "#EEEEEE",
"background": "#111111",
"cursorColor": "#FFFFFF",
"black": "#000000",
"red": "#CC0000",
"green": "#4E9A06",
"yellow": "#C4A000",
"blue": "#3465A4",
"purple": "#75507B",
"cyan": "#06989A",
"white": "#EEEEEE",
"brightBlack": "#555753",
"brightRed": "#EF2929",
"brightGreen": "#8AE234",
"brightYellow": "#FCE94F",
"brightBlue": "#729FCF",
"brightPurple": "#AD7FA8",
"brightCyan": "#34E2E2",
"brightWhite": "#FFFFFF"
}
],
The scheme can then be used by adding its "name"
to the profile’s "colorScheme"
setting. For example:
"colorScheme": "My New Theme"
Keybinding Settings
The "keybindings"
array in settings.json
overrides or supplements the default keybindings set in defaults.json
. Each keybinding is defined as an object with a "command"
and combination of "keys"
. For example:
// Ctrl + Shift + F to open the search box
{ "command": "find", "keys": "ctrl+shift+f" },
In some cases, the "command"
may be an application "action"
with one or more arguments. For example:
// Ctrl + Shift + 1 to open the first profile in a new tab
{
"command": { "action": "newTab", "index": 0 },
"keys": "ctrl+shift+1"
},
The "keys"
value accepts the modifiers ctrl+, shift+, and alt+ followed by:
type | keys |
---|---|
function keys | f1-f24 |
alphanumeric keys | a-z , 0-9 |
symbol keys | - , = , [ , ] , \ , ; , ' , , , . , / |
cursor keys | down , left , right , up , pagedown , pageup , pgdn , pgup , end , home , plus |
action keys | tab , enter , esc , escape , space , backspace , delete , insert |
numeric pad keys | numpad_0-numpad_9 , numpad0-numpad9 , numpad_add , numpad_plus , numpad_decimal , numpad_period , numpad_divide , numpad_minus , numpad_subtract , numpad_multiply |
For example, if you wanted to open the search box with Ctrl + F, you could add a line to the "keybindings"
array in settings.json
:
"keybindings":
[
{ "command": "find", "keys": "ctrl+f" }
]
The search box would also open with Ctrl + Shift + F because that setting is defined in defaults.json
— unless you assign the key combination to another command.
Command Line Options
Windows Terminal can be launched from a shortcut or any Windows or Linux terminal by running wt.exe
. The following options are supported:
option | description |
---|---|
--help , -h , -? , /? |
displays help |
--maximized , -M |
launch maximized |
--fullscreen , -F |
launch full screen |
You can also pass a list of commands separated by semi-colons. Commands are used to define new tabs and panes and with additional control parameters:
command | parameters | description |
---|---|---|
new-tab |
--profile or -p , --startingDirectory or -d , commandline , --title |
open a new tab |
split-pane |
--horizontal or -H , --vertical or -V , --profile or -p , --startingDirectory or -d , commandline , --title |
open a new pane |
focus-tab |
--target or -t |
focus a tab |
Examples
The following examples must be executed from a standard cmd
command line or a shortcut.
Open Windows Terminal with the Ubuntu
and Windows Powershell
tabs:
wt -p "Ubuntu" ; new-tab -p "Windows PowerShell"
Open Windows Terminal with the Ubuntu
, Windows Powershell
, and Command Prompt
profiles in separate panes:
wt -p "Ubuntu" ; split-pane -V -p "Windows PowerShell" ; split-pane -H -p "Command Prompt"
Further examples for launching Windows Terminal from the Linux shell or Powershell are available in the Windows Terminal documentation.
Terminal Treat
I hope you enjoyed this introduction to Windows Terminal. As said, it’s the ideal accompaniment to WSL2. It’s fast, configurable, looks great, and offers all the benefits of both Windows and Linux development.