Still continuing my theme of having a break from Node.js.
This time we are looking at the new Microsoft Windows Terminal, also known as WT.
And what a great product it is.
We will be taking a look at how to use the new Microsoft Windows Terminal to automatically connect to the IBM i for all your SSH shell work.
What is Windows Terminal?
A good place to start as any.
Windows Terminal is a modern terminal application for users of command-line tools and shells, it is a command-line front-end.
It can run multiple terminal apps, including text-based shells in a multi-tabbed window.
It has support for Windows Command Prompt, Windows PowerShell, Windows Subsystem for Linux (WSL) and Azure Cloud Shell Connector.
- UTF-8 & UTF-16 (including emojis) support
- Transparency effects
- Background images
- Full screen mode
- Split panes Mouse input
- Customisable key binding
These are just some of the great features. Customise this great new tool and make your life easier.
It was developed by Microsoft and can be found on their GitHub page. It is worth mentioning that its Open Source too! https://github.com/microsoft/terminal
Installing Windows Terminal
The easiest, and preferred method of installing Windows Terminal is via the Microsoft Store.
If that’s not an option for you, there are other methods of installing on the Microsoft GitHub for Windows Terminal page. See link above.
Search for Windows Terminal and you should see it on the list, normally the first one.
As you can see, I already have this installed.
Starting Windows Terminal
To start windows terminal, we type Windows Terminal, or Windows Terminal, into the windows search box, or use the windows Start Menu.
Upon starting Windows Terminal, you can see here that it has opened a Windows PowerShell tab, if I press the plus sign, I get another tab window on the PowerShell.
It has opened PowerShell has I have that as my default command shell. If you haven’t set this it will open a good old CMD, DOS box.
So, we can see that Windows Terminal is multi tabbed, very handy.
If we take the down arrow option, we get a drop-down menu.
The choices available will depend on the options you have installed on your device.
2. Command prompt
3. WSL (Windows Subsystem for Linux
4. Azure PowerShell
This dropdown menu is totally configurable. For example, if we want a connection to our IBM i we can add that.
Firstly, let us look at the settings.
Microsoft has not added a UI, user interface, to maintain settings in Windows Terminal.
The settings are all held in a JSON file.
Personally, I find this a great way to maintain settings. Makes it so easy to save your settings or set up another Window with the same settings.
By taking the settings option, or Ctrl-Comma short-cut, the settings will open in your default editor.
All json files open in Visual Studio Code on my Surface.
The main part of the settings JSON file is the profiles section, which can be seen in the figure below.
Profiles are the options we have in a drop-down box – as I said I have four profiles.
If we make any changes to our settings, they take immediate effect. If you make any mistakes in the settings, it will let you know!
If you make a complete mess of the settings, just delete everything & then restart Windows Terminal & it will recreate a new settings file for you.
Let us add another profile.
I have Git for Windows installed here and often use Git Bash. So, let’s see how easy it is to add that to our list of profiles.
We will make this profile number 5:
- The GUID is just a unique reference, if you leave it out, WT will assign one for you.
- The name to give it
- Where the program can be found
- And lastly, gives the option an icon
Let us switch back to WT and take a look at our profiles – Yes number 5 is now Git Bash.
Taking that option, gives;
It’s a bit dark for these old eyes, let me change the theme for this.
To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
If you don’t like any of those, you can create your own.
I’m going to choose One Half Light by adding the following to the Git profile and straight away we can see it has changed it, that’s better!
“colorScheme”: “One Half Light”
So, each tab can have its own colour theme, very nice!
That’s how easy & quick it is to add a new option.
Let us take it a stage further and add a menu option to start an SSH connection to our IBM i.
This option will use the OpenSSH feature of Windows 10 to make a connection.
If you don’t have it installed go to windows apps & programs and take the optional features and install OpenSSH client.
So, back to our settings file, and I’ll add my IBM i profile.
A couple of things to note here:
- We make the GUID unique
- Give it a name
- The command line parameter is just SSH the name of the user, the @ sign, then the name of the IBM i you are connecting to – This is just a standard SSH format to start a shell session.
- Next is the icon to use, I’m using our company logo
- Then a font name & size. I’m using Cascadia Code, which was developed by Microsoft for the WT product. It uses font ligatures; I’ll explain in a moment. Don’t worry too much about the size, I’ll show a quick tip later.
- Then I’m changing a couple of the cursor attributes
- Then a couple of parameters on the opacity of the session
Switch over to WT, go to the drop down & we can see option number 6 our IBM i server.
Taking that option & it starts a shell session on our IFS. How cool is that!
Why don’t we add a logo to that session?
As it’s an IBM i shell session, there’s only one logo we can put here!
We use the background image settings to achieve this.
Let me switch back to Windows Terminal, open the new profile, number 6 & voila!
That is neat!
While we are here, I’ll show you the font ligature is a special character that combines two (or sometimes three) characters into a single character.
This can be seen in the on the screen above.
Great for programmers!
Now we know all about logos, why don’t we put a logo on the command prompt?
Back to VS Code and add the logo details for Windows.
Then back to WT and take the Command prompt.
The logo waves!
How about that, we can even use gif’s for logos – All very neat.
To see this effect, take a look at our YouTube channel on how this really looks https://www.youtube.com/c/FormaServeSystemsLtdLoughton
If the font you are working on, looks a bit small at the end of the day, use the Ctrl & mouse wheel to increase, or decrease the font size.
And, you can adjust the opaqueness using the Shift-Ctrl & mouse wheel.
If we want more than one window showing at a time, we can use the Alt-Shift-D shortcut to split the window in to, and again & again.
Handy if we maybe we have Git in one window, Node server running in another etc, etc.
To close a split window use Ctrl-Shift-W shortcut.
To move a split window, use the Alt-Shift-Arrow keys.
Keyboard mapping can be changed if you don’t like the current settings.
We use Windows Terminal all the time to access our IBM i’s I’m sure you will find it useful too.
Using Windows Terminal with IBM i certainly makes using and developing, on Open Source a lot easier. I’m all for that these days 😊
A great tool – thanks Microsoft!
If you have any questions, either on this article, or any other open source, use the comments below, or send me a message on twitter @AndyYouens
Andy Youens is an IBM i consultant/instructor at Milton Keynes, UK-based FormaServe Systems with over 40 years IBM midrange experience.
Mike Ryan says
Great summary. A real opportunity in the entry level area.
Steve Munday says
Hi, many thanks for the article as it reminded me that I’d taken a look at WT when it was in preview but didn’t go any further with it.
Have you managed to get PuTTY to start “in” a tab as I’m finding that PuTTY seems to always force an external session?
Many thanks, Steve
Andy Youens says
Hi Steve, never tried putting Putty in a WT tab. I’ve used WT as a replacement for Putty. I’ll see if I can get it working