At the Build 2019 conference, Microsoft made an exciting announcement: Windows 10 was getting a brand new command-line terminal! Custom built for the command prompt, PowerShell, and the Windows Subsystem for Linux, this new terminal promised to bring a modern, configurable, and open source command-line experience. In May 2020, Microsoft released the 1.0 version of the new Windows Terminal.
Windows Terminal is a separate application from the old Windows command line. This approach allows both terminals to live side by side, and enables Microsoft to rapidly release new features for Windows Terminal without endangering the backward compatibility of the old terminal.
By the end of this chapter, we will be up and running with Windows Terminal, having covered the following topics:
- Why a new terminal?
- The modern foundations of Windows Terminal
- Installing Windows Terminal
- Launching Windows Terminal
We'll cover why Windows needed a new terminal at all, how this new terminal is radically different from the old one, and take our first steps to download, install, and launch it.
To get started with Windows Terminal, you'll need a Windows 10 installation with access to the built-in Microsoft Store application. The minimum version of Windows 10 supported is the May 2019 Update (version 1903, as reported in the output of the
winver command). If you have a relatively up-to-date Windows 10 installation, you have all the tools you need to get started.
Why a new terminal?
Microsoft's old terminal,
conhost.exe, has been showing its age. While it has seen some impressive improvements lately, such as ANSI/VT support and advanced settings, the primary goal of
conhost.exe is to be backward-compatible with older applications. This backward-compatibility constraint can sometimes be at odds with the fast-paced improvements in other parts of Windows 10.
While both PowerShell and the shells running under Windows Subsystem for Linux (WSL) have been seeing constant, rapid improvement, the "user experience" of the Windows command line was in vast need of an upgrade, when compared to its macOS and GNU/Linux counterparts.
As we're getting started, it's useful to understand the difference between a terminal and a shell. A terminal is essentially "what you see" when using the command line—it renders the text, draws any user interface (UI) widgets, and accepts keyboard and mouse input. The terminal will then send this input to the shell for processing. The old terminal on Windows was called
conhost.exe and was the only built-in terminal; however, there were and still are alternative third-party terminals such as ConEmu and Hyper.
A shell doesn't have a UI; it's a command-line program that receives input from the terminal, evaluates that input, and returns the result. Shells, such as the command prompt, PowerShell, and those running in WSL, require a terminal to collect input and display output. Launching the
powershell.exe shells from the Start menu or Run dialog will implicitly start the
conhost.exe terminal, which can make the distinction less obvious for end users:
This delineation between terminals and shells means that switching to the new Windows Terminal is painless—the shells, such as the command prompt and PowerShell, are not changing. All existing knowledge and documentation of the command prompt, PowerShell, and shells under WSL can be reused, but commands will be sent through the new, more powerful Windows Terminal instead of the older, more barebones
conhost.exe. Let's see what makes this new Windows Terminal so much better!
A more in-depth discussion about the differences between shells and terminals can be found on Scott Hanselman's blog at https://www.hanselman.com/blog/whats-the-difference-between-a-console-a-terminal-and-a-shell.
The modern foundations of Windows Terminal
Earlier, we learned that Windows Terminal is built from the ground up to provide a more modern and flexible command-line experience. This command-line experience has three main parts: a modern UI, a flexible JSON-based customization system, and its open source development.
A Modern UI
When working with the command line, it's common to have a couple of command lines open. Perhaps a couple of operations need to be monitored at the same time, or some commands need to execute in PowerShell, and others need to use WSL. In the old terminal, the only option is to open separate windows and then Alt + Tab between them.
The new Windows Terminal comes with multiple options for managing these tasks. It features built-in tab support, each tab with its own shell, and all available within the same window:
Additionally, some operations work best with multiple shells open side by side. The old terminal again had no support for this; the only option was to use separate windows positioned next to each other. The new Windows Terminal supports "panes" that can open multiple different shells within the same tab. It's not just limited to two panes, either—the terminal supports multiple side-by-side panes split both vertically and horizontally:
We'll dive more into efficient tab and pane management in Chapter 2, Learning the Windows Terminal UI.
Improved visual effects
The modern UI features are not just limited to tabs and panes; the entire terminal has been written from the ground up to take advantage of the latest technology. The terminal itself is written using the Universal Windows Platform (UWP) framework with XAML Islands, and text rendering is handled by a GPU-accelerated rendering engine using DirectX.
This technology stack, in addition to being a flexible, fast, and solid foundation, enables improved visual effects as well. For example, the new Windows Terminal natively supports transparency using an effect called acrylic, as well as background images and GIFs:
Improved fonts and rendering
The new, GPU-accelerated rendering engine has all the modern features expected for a first-class command-line experience. The GPU acceleration results in ultra-fast and crisp text rendering, and the new rendering engine enables Unicode character support. While full, multi-language Unicode support is still a work in progress, the foundation is laid.
To show off the new Windows Terminal's font-rendering capabilities, Microsoft released a brand-new open source programming font named Cascadia Code, which is bundled in Windows Terminal:
Cascadia Code currently has support for a wide range of characters, including Cyrillic, Greek, and Vietnamese. It's open source, licensed under the SIL Open Font License, so progress for supporting additional languages can be tracked on GitHub, at https://github.com/microsoft/cascadia-code/.
Cascadia Code is called a programming font due to its support for optional programming ligatures. A ligature is a font feature that allows multiple characters to be rendered as a single glyph. For example, when typing the characters in the first row in the following image, they will be rendered as the bottom row:
In addition to programming ligatures, Cascadia Code also supports Powerline glyphs, a popular terminal customization that can improve the look of the command-line prompt, making it stand out from the input/output text around it:
As mentioned, all these features are optional—the Cascadia font comes in four variations that allow enabling or disabling of both programming ligatures and Powerline glyphs:
We'll cover Powerline customization in detail in Chapter 5, Changing your Windows Terminal appearance.
Flexible JSON-based customization
Customization of the old terminal was quite frustrating; the options were distributed across both the Windows Registry and inside the shortcut files themselves! The new Windows Terminal fixes this and features a
settings.json file with a documented schema.
The benefit of using a JSON file with a schema is two-fold: editors such as Visual Studio Code can provide a first-class editing experience with documentation and autocomplete, and the
settings.json file can be version-controlled and easily shared across computers.
Additionally, the built-in Settings UI provides an easier way to customize the terminal. The Settings UI still uses the
settings.json file behind the scenes, so the resulting configuration can still be easily shared and version controlled.
settings.json file controls all aspects of the terminal, such as its themes and colors, keybindings, and window behavior. We'll dive deep into this file in Chapter 4, Customizing your Windows Terminal settings.
Open source development
The new Windows Terminal is open source! All development happens on Microsoft's GitHub repository, at https://github.com/microsoft/terminal/. The development team is incredibly active in this repository; bug reports, feature planning, and feature development happens in the open. Reading through this code repository, downloading the code, and even contributing to it is encouraged!
In addition to open source code, the documentation itself is open source. The documentation is hosted at https://aka.ms/terminal-docs, and clicking the Edit this Document link will navigate to the relevant document on GitHub. Edits to the documentation follow the typical pull request process, using Markdown for formatting.
The repository has hundreds of open source contributors, working on all aspects of the terminal. Several major features, such as background image support, have been added by the community. Whether it's improving documentation, submitting bug reports, or discussing and then adding features, feel free to get involved! Check out the
CONTRIBUTING.md file in the GitHub repository to get started.
Now that we've covered the benefits of the new Windows Terminal, let's take our first step and get it installed!
Installing Windows Terminal
There are several ways to get the new Windows Terminal. The easiest and recommended way is to install it from the Microsoft Store. The Microsoft Store is part of Windows 10 and will ensure we have a seamless installation experience. Updates to Windows Terminal are also delivered through the Microsoft Store.
- From the Windows Start menu, search for the
Microsoft Storeand open it.
- From inside the Microsoft Store, search for
- Select Windows Terminal and then click Get.
- Wait for Windows Terminal to download and install.
- Optionally, inside the Microsoft Store app, enable automatic updates by going to Settings and select Update apps automatically.
While this is the best way to both install the new Windows Terminal and ensure it stays up to date, there are several other ways to install Windows Terminal that might better fit certain automation scenarios:
- Using the command-line
winget install --id=Microsoft.WindowsTerminal -e
- Using the command-line chocolatey installer (unofficial):
choco install microsoft-windows-terminal
- Advanced users can download a pre-built release from GitHub, located at https://github.com/microsoft/terminal/releases. Install the Desktop Bridge VC++ v14 Redistributable Package as a dependency first.
- Advanced users may also be interested in the Windows Terminal Preview application from the Microsoft Store, which can be installed alongside the Windows Terminal application. Windows Terminal Preview provides access to the latest features, though there may be some stability issues.
Now that we have Windows Terminal installed, let's start it up!
Launching Windows Terminal
The normal way to start Windows Terminal is to select it from the Start menu, either by selecting the icon using the mouse or typing out the words
windows terminal in the Start menu search bar.
Luckily, there are faster ways. Windows Terminal ships with a binary,
wt.exe, that can be used to quickly start the terminal. Press wt<enter> from the Start menu, Run dialog, or Windows Explorer location bar to open the terminal.
wt.exe has several interesting command-line flags, such as
-F to launch in fullscreen mode. We'll learn more about the capabilities of
wt.exe in Chapter 6, Setting up keyboard shortcuts.
An additional way to start Windows Terminal is to use the taskbar keyboard shortcuts, such as Win + 1, Win + 2, and so on. Pin the application to the taskbar by finding the Windows Terminal application in the Start menu, right-clicking it, and choosing Pin to taskbar. Then, on the taskbar, drag the Windows Terminal icon all the way to the left so it's the leftmost icon. Now, pressing Win + 1 will launch Windows Terminal, or bring it into the foreground if it's already open:
Now that we have the Windows Terminal pinned to the taskbar, we can right-click on the icon to open a Jump List Menu, where we can open Windows Terminal directly to our desired shell:
The final way we'll learn to open Windows Terminal is from Windows Explorer. Open Windows Explorer (Win + E) and then right-click any directory. Select the Open in Windows Terminal menu item to open that directory in Windows Terminal. Additionally, right-clicking or pressing Shift and right-clicking on the background of Windows Explorer shows an Open Windows Terminal here menu option that will open the current directory in Windows Terminal:
In this chapter, we learned the differences between a terminal and a shell. We discussed how the new Windows Terminal has several key benefits over the older
conhost.exe, including a modern, GPU-accelerated UI, a flexible JSON-based configuration system, and an open source community. In addition, we learned a few ways of installing the new Windows Terminal, as well as how to efficiently launch it from anywhere in Windows 10.
In the next chapter, we'll learn how to effectively use Windows Terminal. We'll cover all major components of Windows Terminal, including the terminal tabs, panes, and interacting with various shells. We'll also cover a few interesting keyboard shortcuts, as well as the new command palette feature.
If you found the discussion of terminals versus shells interesting, you may also enjoy reading about ConPTY—the new modern console infrastructure that enabled Windows Terminal to be possible in the first place! Rich Turner, when he was the Senior Program Manager of Windows Console and Command Line, wrote an excellent blog post series titled Windows Command-Line that walks through the nitty-gritty details: https://devblogs.microsoft.com/commandline/windows-command-line-backgrounder/.
If you're interested in learning more about the modern technology powering the new Windows Terminal, check out Building Windows Terminal with WinUI by Kayla Cinnamon, the Program Manager of Windows Terminal, Console, Command Line, and Cascadia Code: https://devblogs.microsoft.com/commandline/building-windows-terminal-with-winui/.