16 : Taming the Terminal

01 Apr 2022

This week we're discussing Windows terminal - how to get it, how to configure it, what it can do for you. We'll discuss the benefits of the terminal, making it look pretty, setting up some shortcuts to save you some keypresses and make you more efficient. 

Random fact

Why is Easter called Easter?

According to scholars, this Christian holiday was named after the Anglo-Saxon goddess, Eostre, who was depicted as a Fertility Goddess and a Goddess of Dawn and Light.

Introduction

The new windows terminal 🥂 🎉 🥳.

Ok some terminal-ology 😃 see what I did there 🤣

😆 Oh yes, its time to console-idate 😂 our understanding of the terms!!!!!

Terminal

The word Terminal comes from terminate, indicating that it's the terminating end or "terminal" end of a communications process. You'll often hear "dumb terminal" when referring to a text-based environment where the computer you are sitting next to is just taking input and showing text while the real work happens at the other end in a mainframe or large computer.

TTY or "teletypewriter" was the first kind of terminal. Rather than a screen you'd have a literal typewriter in front of you. When you type on it, you're seeing the text on a piece of paper AND inputting that text into a computer. When that computer replies, you'll see the typewriter automatically type on the same paper.

When we refer to a Terminal in the software sense, we're referring to a literal software version of a TTY or Terminal. The Windows Terminal is that. It's really good at displaying textual output. It can take input and pass it on. But the Terminal isn't smart. It doesn't actually process your input, it doesn't look at your files or think.

Console

Folks in the mid 20th century would have a piece of furniture in their living room called a console or console cabinet. A Console in the context of computers is a console or cabinet with a screen and keyboard combined inside it. But, it's effectively a Terminal. Technically the Console is the device and the Terminal is now the software program inside the Console.

In the software world a Terminal and a Console are, for all intents, synonymous.

Shell

A shell is the program that the terminal sends user input to. The shell generates output and passes it back to the terminal for display. Here's some examples of Shells:

• bash, fish, zsh, ksh, sh, tsch • PowerShell, pwsh • cmd, yori, 4dos, command.com

To get it install it from the Windows App store

auto updates, latest version

Features

Tabbed UI allows you to have many windows open at once each with a different shell and it supports any shell you may have installed - Powershell, CMD, Bash, Ubuntu, WSL, Git bash

Arrange windows in any way you want - columns, rows, split a window into 2 horizontal/vertical.

Adding background images so you can see at a glance which shell you’re in - PowerShell, Ubuntu, CMD, git-bash

Change settings via the new(ish) UI or by editing the JSON settings file - this gives access to some newer features not yet added to the settings UI.

Open source - go and have a look at the source!

How do you get it? You can install from source, but easiest way is to install from the windows store, then you get auto updates.

Making it look good

Setup the look of your terminal - Andy uses Powershell day to day and have that setup looking the way I want using...

Rowan uses git bash day to day - really like using the bash utilities like grep, curl, find etc

Oh my posh (https://ohmyposh.dev/)

A prompt theme engine for any shell

Gives you a really nice prompt containing any information you like to see

Works in Windows, Mac and Linux - Install for windows is via Install-Module in PowerShell

Mine currently includes the folder, git branch, .NET SDK version and an indicator showing if the last command was successful - these are called Segments and there are loads of them!

A font that supports ‘Glyphs’ and Ligatures

To be able to display nice icons in the command prompt you’ll need to install a font that supports them. I use Cascadia from MS - https://github.com/microsoft/cascadia-code/releases?WT.mc_id=-blog-scottha but you can check out others at https://www.nerdfonts.com/ and by using https://www.programmingfonts.org/#cascadia-code.

Terminal icons

Add colour and icons to your directory listing

PS> Install-Module -Name Terminal-Icons -Repository PSGallery
Import-Module -Name Terminal-Icons

Now you have at a glance icons for files and folders.

terminal showing file type icons

OS project/utility of the week

Obviously Terminal but we already did that in EP 6 (The wheels on the (service) bus)

https://www.autohotkey.com/

AutoHotkey is a free, open-source scripting language for Windows that allows users to easily create small to complex scripts for all kinds of tasks such as: form fillers, auto-clicking, macros, etc.