Book Image

Windows Terminal Tips, Tricks, and Productivity Hacks

By : Will Fuqua
5 (1)
Book Image

Windows Terminal Tips, Tricks, and Productivity Hacks

5 (1)
By: Will Fuqua

Overview of this book

Windows Terminal is a new and open-source command-line application for Windows 10, built for the Command Prompt, PowerShell, Windows Subsystem for Linux, and more. It's fast, modern, and configurable thanks to its GPU-accelerated rendering, excellent UTF-8 support, and JSON-based configurability, and this book can help you learn how to leverage these features. You’ll start by learning the benefits of Windows Terminal and its open-source development, as well as how to use the built-in tabs, panes, and key bindings to build your own efficient terminal workflows. After you’ve mastered Windows Terminal, this book shows how to use and configure PowerShell Core and the Windows Subsystem for Linux within Windows Terminal. You’ll maximize your productivity using powerful tools such as PSReadLine for PowerShell and ZSH on Linux, and discover useful tips and tricks for common developer tools like Git and SSH. Finally, you’ll see how Windows Terminal can be used in common development and DevOps tasks, such as developing frontend JavaScript applications and backend REST APIs, and managing cloud-based systems like Amazon Web Services (AWS), Microsoft Azure, and Google Cloud. By the end of this book, you'll not only be well-versed with Windows Terminal, but also have learned how to effectively use shells like PowerShell Core and ZSH to become proficient at the command line.
Table of Contents (20 chapters)
1
Section 1: Introducing the New Windows Terminal
5
Section 2: Configuring your Windows Terminal and its shells
12
Section 3: Using your Windows Terminal for development

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 cmd.exe or 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:

Figure 1.1 – PowerShell, running in both the old conhost on the left, and the new Windows Terminal on the right

Figure 1.1 – PowerShell, running in both the old conhost on the left, and the new Windows Terminal on the right

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!

Note

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.