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

Using built-in commands and aliases

In this section, we'll review some useful commands built into PowerShell Core. These commands will work on any PowerShell Core installation and will increase the speed that we can operate on the command line.

Automatic Variable: $^ and $$

In PowerShell Core (and the older PowerShell 5), the automatic variables $^ and $$ always contain the first and last word of the previous command, respectively. PowerShell keeps this variable up to date as we issue commands. For example, let's create a new directory and then navigate into it using the $$ variable:

> cd ~/Desktop
> mkdir SubDir
> cd $$

Rather than retyping the name of the new directory, we can use the $$ variable. When executing the cd $$ command, the $$ variable represents the last word of the previous command, that is, SubDir. This changes the directory to SubDir.

Next, let's look at the $^ variable, which contains the first word of the previous command. We...