Building an Optimal Software Development Environment - Part 4.5: Windows Terminal
Windows Excels at Multi Shell Use With Windows Terminal
Previously we covered setting up your Mac with Iterm2 and we are going to do the same for Windows. Windows is a more viable development platform than ever thanks to the advent of Windows Subsystem for Linux, which allows for a native linux environment but with the familiarity of Windows User Interface. We can take advantage of WSL and the other shells provided through Windows to build the ultimate Windows Terminal setup that will enhance your work on the system just as we did on Mac.
You might wonder why someone who switch to Mac would even care about setting up a Windows terminal, but the reality is I spend more time on my work laptop than my personal one, so that means my Windows setup needs to be even better based upon the ratio of time I spend at work. The better my work setup is, the faster I can accomplish the tasks for the day and then turn my attention to my personal work.
Additionally Windows and Linux based systems are the two most popular deployment environments for software which makes it a perfect OS for cross platform work. Since WSL enables a total and complete shell with a full linux Kernel but doesn’t lock you down to Linux based UIs, you get massive amounts of software compatibility suddenly with a great user experience. Even with my qualms of Windows UI going downhill I still find it better and more familiar than most Linux based interfaces. Working in Windows and then dipping into the Terminal to run things like wget, curl, jq, grep and untar to look at and process data is a common occurrence for me and having those tools easily available to me makes my job much easier. More serious tools are also available and better in Linux like terraform, aws cli, and others. File system access between the two is easy (though can be slow cross mounts) which enables fast collaboration for the two environments to swap data between. You can see a more detailed explains of the two terminals here.
Enough convincing, let’s get to setting up a Terminal on Windows that enables this!
Windows Terminal
For our terminal of choice we are going to use Windows Terminal. It is a serious project from Microsoft to have an excellent Terminal that can finally challenge Linux based ones. The built in Console for Windows is trash and offers minimal advanced usage compared to a default terminal from Mac. The original console host has little customization options for colors and themes, no tab support, unideal text buffer resizing, and just poor performance in general. There are many reasons why Window’s console is so limited in functionality but the main reason is legacy compatibility. The console needs to work the same going back to at least Windows NT , so in terms of upgrades there are not many.
As for why Windows Terminal you can see Microsoft’s own words on that. But if you’re familiar with any advanced terminals you get what you expect. Custom fonts with ligatures, themes, and backgrounds. Tab support with multiple panes, UTF-8 support with GPU rendered text for faster performance, and multiple profiles that you can set to different shells and customize them accordingly.
To get started you can download from the…. Windows Store. Yes this is terrible but it’s a UWP app so you will want if you want automatic updates you have to go through the store or compile from source on their github repo. I download from the Store since it’s easy and it is for the work PC but if you’re turbo go ahead and compile from source. After install it will launch for you and you will be in the terminal.
Depending on your existing system setup you may be launched into a different shell than the one you see here. I have Powershell Core installed which is the ideal default shell for me. Using the Arrow dropdown next to the new tab icon you can select a different shell for now. Sometimes I actually need to use cmd.exe and regular Powershell so this is a great feature if you work in varying shell environments. Some older tech companies still have legacy processes that rely on these older shells and this will help you out and get you off using the default console host and keep your sanity.
If you have WSL installed you will also see an option for every distro you have here. I don’t need all these shells of course, so if you click on Settings in the drop down you can select the profile and then scroll to the bottom and select “Hide Profile from Dropdown”. Additionally I like to setup an Admin profile for my Windows Shells. You can do this easily in the Profile section of Settings Menu, scrolling down to “Add a new profile”, and then duplicating the desired shell, and then enabling Admin launcher in the profile settings and also renaming the profile to have Admin in it. Our end result is the following:
To bring it all together, we installed Windows Terminal, have access to a profile per shell type, a shell for Admin access, and a shell for our Linux distro! Already we have an immense productivity by hosting all these shells (and operating systems!) under one app within the Terminal. Often I will have one of each opened up and swap between them as needed. I will use Powershell for Windows operations and basic file system navigation and scripts and WSL for items and tools that are better are native Linux.
We can continue to add profiles as needed if we have different workloads, and we can also modify the launch command if we have a specific switch or command line param we wish to pass to the shell. For WSL this could mean launching a different user and to a different directory instead of the default one by customizing the cmd line command. To do so, clone the linux based profile you want and edit the “Command Line Section” as below.