Over the past several years Microsoft has dedicated significant resources to enhance the command line capabilities of Windows. First they introduced PowerShell, then the Windows Subsystem for Linux (WSL), and now Windows Terminal.
What is Windows Terminal?
On the surface it seems to be a basic terminal interface, but under the hood Windows Terminal hides some significant capabilities. First and foremost, Windows Terminal enables you to spawn multiple different shells from the same interface including the Windows Command Prompt, PowerShell, and if you have WSL installed, a Linux shell using Ubuntu, Kali, or other available distributions!
How to Install Windows Terminal
In order to use Windows Terminal you will first need to install it. You can install it by going to the Microsoft Store in Windows 10 and searching for "Windows Terminal". Next select "Windows Terminal" and then click "Get".
You can also access the installer from your browser here.
Welcome to Windows Terminal
Once installed, you can launch Windows Terminal from the Start Menu, by typing wt in the Command Prompt, or by left-clicking on the Desktop or file explorer and selecting "Open in Windows Terminal".
You can use the drop-down menu in Windows Terminal to select the type of shell you want to open, and each one opens in a new tab by default.
Panes
In addition to tabs, Windows Terminal panes allow you to display multiple shell instances within the same window. Using Panes you can display the Command Prompt, PowerShell, and a Linux shell all at the same time, or you can display multiples of the same shell.
Hold the [Alt] key while selecting a shell from the drop-down menu and it will add a new pane to your current tab rather than opening a new tab. You can also use the default keyboard shortcuts below to add and manipulate panes.
Command Palette
The Command Palette allows you to view and execute commands within Windows Terminal, and it also lists the current keyboard shortcut bindings. Use [Ctrl] + [Shift] + [P] to access the Command Palette.
To execute a command simply select it using the mouse or arrow keys.
You can add additional commands and keyboard shortcuts to Windows Terminal by editing the settings file.
Customizing Windows Terminal
To customize Windows Terminal click Settings from the drop-down menu or use the keyboard shortcut [Ctrl] + [,].
Here you can change everything from the terminal color schemes to how the program will behave on startup.
You can also modify more advanced settings by editing the Windows Terminal JSON file. To do that click "Open JSON file" at the bottom left of the Settings screen. The settings file will open in your default JSON editor.
Within the JSON file there is an array called actions:
You can define new Windows Terminal commands using this array. Commands use the general format:
{ "command": "commandName", "keys": "modifiers+key" }
commandName
This is the action that will occur when you execute the command.
Numerous commands exist including splitPane, newTab, closeTab, and others.
Note that some commands also have options available.
modifiers+key
This specifies which key combination will cause the command to execute.
Valid key modifiers are ctrl, shift, and alt.
Valid key values include f1-f24, a-z, 0-9, arrow keys, and numerous other symbols.
As an example, you can add the item below to your JSON actions array, which will open a new Command Prompt pane in Windows Terminal using the [Alt] + [Shift] + [C] keyboard shortcut.
{
"command": {
"action": "splitPane",
"split": "auto",
"commandline": cmd"
},
"keys": "alt+shift+c"
}
This uses the splitPane command and two arguments to achieve the functionality. The option "split": "auto" tells Windows Terminal to split the screen horizontally or vertically automatically based on best fit. The "commandline": cmd" option tells Windows Terminal to load the pane with a Windows Command Prompt shell.
Conclusion
Windows Terminal is an exciting addition to Microsoft's growing portfolio of command line capabilities. The ability to run Windows Command Prompt, PowerShell, and Linux shells all from the same interface provides the ultimate in flexibility.
Links and Resources
For more information on adding commands see Microsoft's article on Custom actions in Windows Terminal.
For information on customizing Windows Terminal's appearance see Microsoft's article on Appearance profile settings in Windows Terminal.
To install Windows Terminal visit the Microsoft Store.
Commentaires