Windows Terminal: A Must-Have Productivity Tool for Windows Programmers
Tips and tricks of using the new tool windows terminal to manage your programming work
As a programmer, we often need to use different command-line tools, like command prompt (CMD), PowerShell, Anaconda, google cloud SDK, Azure SDK, etc.. All these tools are pretty much independent from each other. You may feel that you can manage all these by yourself. However, I am sure that the integration tool Windows Terminal will be a game-changer of your programming productivity. Let’s check out Windows Terminal.
Features of Windows Terminal
Windows Terminal is a contemporary terminal application for users of command-line tools and shells like command Prompt, PowerShell, and Windows Subsystem for UNIX (WSL ). Microsoft made the initial release in May 2019, the preview release in July 2020, and the first stable release in August 2020.
Windows Terminal has the following important features: include the integration of any command-line tools, multiple tabs, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and the ability to create your customized themes, text, colors, backgrounds.
Let’s install it first and then explore several key features.
Installation of Windows Terminal
The installation of Windows Terminal is super easy and fast. You can install Windows Terminal through Microsoft store with one click.
How to Integrate All the Command-line Tools
The initial installation of Windows Terminals by default includes Command Prompt, Windows PowerShell, Azure Cloud Shell, and Ubuntu. We can add other frequent used tools to it. Below is the screenshot of some tools that I have added to my Windows Terminal:
As you can see from the screenshot, I have added Anaconda, gcloud SDK, Git Bash, and PuTTY. I will use Anaconda as the example to walk through how we can add a new application to Windows Terminal.
By clicking ‘Settings’ on the menu, your computer will use microsoft visual studio to open the configuration file (settings.json) which you will find the profiles setting listing all the you have currently include in Windows Terminal. You can add any other tools by inserting an item to the list. Below is the item that I add for Ananconda:
{
// Make changes here to the cmd.exe profile.
"guid": "{799fa555-861d-4a1e-ac05-f44dfe39bdb6}",
"name": "Anaconda",
"commandline": "cmd.exe /K C:\\ProgramData\\Anaconda3\\Scripts\\activate.bat",
"hidden": false,
"icon": "C:\\ProgramData\\Anaconda3\\Menu\\anaconda-navigator.ico",
"startingDirectory": "%USERPROFILE%"
}
On ‘guid’: you can generate a new guid in PowerShell through the following code:
[guid]::NewGuid()
You can just copy and paste the generated guid to this new item.
You can give the name at your will. I name the link as ‘Anaconda’.
The next key thing is the ‘commandline’ info. To find out this info, we first go to the system menu and right click ‘Anaconda Prompt (Anaconda3)’ to ‘open file location’ as below:
In the file location folder, we will see all the shortcut under Anaconda. Continuing right click of ‘Anaconda Prompt (Anaconda3)’, we can get the following screenshot:
The commandline info should come from the ‘Target’ box and the “startingDirectory” comes from ‘Start in’ box.
Other information like icon are optional. You can customize the icon at your will.
We can use the same approach to add the shortcut for ‘google cloud SDK shell.’ You may get the info as below:
{
"guid": "{8dbe5f27-48f1-4ce3-b695-ec3dde7dcd6d}",
"hidden": false,
"name": "gcloud SDK",
"commandline": "C:\\windows\\system32\\cmd.exe /k \"C:\\Users\\ppeng\\AppData\\Local\\Google\\Cloud SDK\\cloud_env.bat\""
}
The git bash info may look as below:
{
"guid": "{05e3ab66-d88a-42b5-9431-ead17851486d}",
"hidden": false,
"name": "Git Bash",
"commandline": "C:\\Program Files\\Git\\git-bash.exe --cd-to-home"
}
and the PuTTY info may look as
{
"guid": "{66444279-3522-4e8d-a0f7-d288e6139a39}",
"hidden": false,
"name": "PuTTY",
"commandline": "C:\\Program Files\\PuTTY\\putty.exe"
}
Based on the order of all the applications, Windows Terminal automatically create the shortcut for each app: ctrl + shift + number 1, 2, …n
Feature: Search Command History
You may have typed many command lines during your work session and often you would like to reuse some of the commands. It may take you lots of time to find the right history by scrolling the history. With Windows Terminal, you can quickly locate the command lines by keybinding ‘Ctrl+Shift+F’ to open the historical commands search box.
Feature: Multiple Tabs
We often need to open many applications concurrently. It may waste some of time to navigate between so many open application windows. Windows Terminal Mutiple tabs feature can help organize and manage these applications much better. With the preselected icons, we can easily identify the application we want to select. We can also rename the tabs or color-coding the tabs to help us distinguish the tabs. With the same tab, we can also use multiple panes within the same tab. You can refer to https://docs.microsoft.com/en-us/windows/terminal/tips-and-tricks for more details.
Feature: Windows Terminal Panes
Sometimes you may want to open several panes in the same tab. You can do that through Windows Terminal Panes. Panes give you the ability to run several command-line applications within the same tab next to each other.
‘alt + shift + +’: create a new vertical pane in the current pane.
‘alt + shift + -’: create a new horizontal pane in the current pane.
‘ctrl + shift + w’: close the current pane.
All these settings are configured in the keybindings section. You can refer to the documentation page for more details.
By exploring these wonderful features, we can find that all these features are clearly defined in the setting file. We can even try to define some customized features following the same approach.
With Windows Terminal, I have fallen in love with command-line coding.