The Windows command prompt. My old friend, you have not aged well.
This is a relic from another era, and now it's had an upgrade!
Welcome to the Windows Terminal.
Welcome back to The Pro Tech Show. Thanks to Shaik for this video suggestion.
If you have any ideas you'd like me to cover, then feel free to drop them in the
comments below. The Windows command prompt we all know
hasn't changed for decades; and compared to alternatives
it... kind of sucks. The thing is, it actually sucks by design. Yes, they made
it rubbish on purpose! If you already know the difference
between a terminal and a shell, and you're impatient to see the shiny things,
then i'll add timestamps so you can go and skip ahead; but
don't blame me if you do that and get confused!
Those of us who've been around the block a bit may have heard the Windows command
prompt referred to as the DOS prompt. It isn't a
DOS prompt, but it does look like one. DOS is the
Microsoft operating system that existed before Windows.
It was a command-line operating system. You typed in text and the computer
responded with text. That's as fancy as it got. Now, Windows
has matured quite a lot since then, and most people don't interact with the
command line anymore. That's most "normal" people anyway. IT
admins use it a ton, because it's great for automation. In a
modern Windows operating system, that command-line interface is provided by
the Windows command prompt; but why is it still so... old?
One of the primary reasons it exists is for backward compatibility.
A lot of places have built up tools and scripts over the years that inherently
assume the behavior of the command line doesn't change.
Some businesses run on these things behind the scenes.
I'm not even talking about scripts that haven't been migrated to PowerShell.
I'm talking about scripts that haven't even been properly migrated to
Windows yet! A lot of businesses are still reliant on the old DOS command
line from before Windows NT. For the youngsters in the
audience, Windows NT came before Windows 2000, which came for Windows XP.
I'm sure you've heard of XP, right? Windows 95 and 98 were the consumer versions
which ran parallel to NT, but were actually based
on DOS. We don't talk about Windows ME. If you
work in IT and can't believe people are still reliant
on such outdated technologies, just check your network for batch files
with the extension ".BAT". If you've got any (and i know a lot of
you do) then you're part of the reason we need this legacy stuff. ".BAT"
means a script is intended for the old 16-bit DOS world.
anything in NT or later should be using a ".CMD"
extension. ".BAT" scripts still work, but only thanks to backwards compatibility.
This is why the Windows command prompt sucks.
Even in Windows 10, it needs to behave like an obsolete operating system from
the early 80s; because if Microsoft change it, it could
wreak havoc across the globe. Of course these days we have PowerShell.
PowerShell is much more functional than the old command prompt, and a giant leap
forwards for the Windows command line. The thing is... PowerShell can't replace
the command prompt because "backward compatibility". So we have both.
In fact, whilst PowerShell is massively more useful in the old command prompt,
the user interface is exactly the same. What gives?
Time for a quick terminology lesson, here. The command line is actually composed of
two distinct components. The bit you type into is called the
"terminal", and the back-end piece that does all the processing is called the
"shell". Sorry Linux peeps - I know that's a
simplification, and Windows now has a pseudo console as well;
but for the purposes of this video we don't need that level of detail.
This goes back to the early days of computers, when people sat at a dumb
terminal which was basically just a keyboard and monitor attached to a
cable. The computer was separate. When you typed,
the characters from your keyboard were sent to the computer.
When the computer responded, it sent a stream of characters back to the
terminal, which displayed them on the monitor. If
you go back even further before monitors were common,
then the terminal would output the character stream onto a printer
instead. These days we don't have physical
terminals. Instead, we have terminal applications which do the job of the
physical terminals people used to sit at. The Windows command prompt you see on-screen
and interact with is actually a terminal program called the
"Windows Console". It connects to a shell called the
"Command Prompt" that does the actual processing.
PowerShell is a much more modern shell on the back-end, but the terminal
application you're interacting with is still the same Windows Console
application. OK. We know why the old shell needs to
stick around, but why is the terminal app, that Windows
Console not evolved? It has, actually. There have been a number
of improvements over the years, but there's still that issue of backward
compatibility. If Microsoft change it too much, stuff
could break. If they do something that changes its
performance, that could cause a critical system
somewhere out in the world to go horribly wrong. Seriously,
that stuff happens. In steps the Windows Terminal.
This is a modern re-imagining of what a command line terminal should be. OK,
maybe there's a little bit less imagination going on, and a little bit
more looking over the shoulder of Linux; but it's much more modern and much
better than the old console. Just like PowerShell can't replace the
command prompt for fear of breaking something though,
the Windows Terminal can't replace the Windows Console for the same reason.
So to get the Windows Terminal, you grab it from the Microsoft store for free,
and install it alongside the traditional Console.
This is just a terminal. It's the bit you type into and read text from.
The default shell it connects to is PowerShell. I said "default" because it's
not tied to a particular shell. You can use it to connect to PowerShell,
the old command prompt, Bash... Yup. You heard that right. If you did a
double-take on that last one, then go watch my video about running Linux
inside Windows 10. The Windows Terminal will automatically
discover any Linux distributions installed in WSL
and will add them to your new tab drop-down list as well.
Because, yes. The Windows Terminal now supports tabs.
No need to have a ton of command windows open. But that's only the
beginning. You can customize just about every part
of this Terminal. You can change colours, create custom tab
profiles, you can even split it into multiple panes.
It's all controlled through a JSON settings file. Now there's
loads you can do here, and walking through all of the options we get
quite boring. I'll leave you to do that in your own time,
and i'll put a link to the documentation in the video description for you.
Instead, I'm going to quickly apply some settings i made earlier; so you can see
some of the possibilities, here. The first thing you probably noticed is
that the background of my PowerShell window turned blue,
and then translucent. There are a lot of graphical tweaks you can make to this to
personalise your terminal. Some are just for fun, like the retro look I've given
the old command prompt. Others are a bit more practical. You'll
notice Ubuntu and Kali in the drop-down now have icons specific to those
distributions, rather than a generic Tux the penguin. If I
open them, you can see I've applied a custom
background image as well. So if I'm working with multiple tabs here, it's
easier to keep track of which one I'm in. Again, if you're wondering how I'm
running Ubuntu an Kali in Windows, go check out that Windows Subsystem for
Linux video. I'll drop a link in the description if you missed it last time
around. Just to confirm, though; that is Kali
Linux, running on the Windows Linux kernel,
in WSL2. As well as graphical customisations, there are some
interesting functional tweaks you can do as well to make life a little bit easier
and improve your workflow. Take this Nextcloud profile, for example.
If I open that, it's not running in WSL. That's a
separate Linux server in my lab. The profile I've created for it in the
Windows Terminal is connecting an SSH session so it behaves as a remote
terminal to that server. Just to confirm, that's Centos 7 using its
normal Red Hat derived kernel. It's not running in WSL. You could do the
same thing for Windows servers using remote PowerShell, too.
Speaking of PowerShell, you'll see I've created a few profiles for Office 365
and Exchange. If I open the Office 365 one you'll
notice a bit of initialisation going on in the background.
This profile is opening PowerShell, then running a script to connect up to
various Office 365 services. So if you're an Office 365 admin, a
profile like this could save you creating a bunch of remote connections
manually, and authenticating to all of them. Once
this opens, I have direct access to Azure AD,
Exchange Online, and Teams; and of course it's your script so you can add whatever
services you want into it. The Exchange profiles I've created are
similar, but I've used them to show off a different feature. As well as having
multiple tabs, you can split a single tab into multiple panes each with - their own
mini-terminal. Unfortunately, as yet you cannot create a
profile with multiple panes in it; but you can pass command-line arguments
to the Terminal app to have it open with multiple panes.
I've created an Exchange terminal shortcut that opens a single tab with
two panes - one for Exchange Online and the other
for Exchange Server. This sort of thing could be handy for
someone who administers a hybrid Exchange infrastructure.
These are all just examples, of course. I'm not trying to provide an exhaustive
list of customisations - more give you a flavour of what you could do.
If you look online you'll see some creative uses of terminal customisation.
It supports Unicode and custom fonts; so you can have smileys, icons, and all sorts
in it. Soon it will have support for clickable
hyperlinks and rudimentary animations as well.
If you find yourself using a lot of command line - particularly remote SSH or
PowerShell management; there's potential for you to mould
yourself a nice little time-saver here with custom profiles.
Now, I was specifically asked about performance.
Is there any performance advantage using the new Windows Terminal over the old
Windows Console? There are definitely efficiency benefits
to be had, but in terms of computing performance...
"yes"... but probably "no". Remember that the terminal is just an interface.
All of the actual computation happens via the shell, and that
hasn't changed; whether it be PowerShell, Bash, or the old command prompt.
The new Terminal does use GPU acceleration to draw its text, which
allows it to be prettier, and in theory I guess... faster?
If you're one of the people who rushed out to buy a brand new RTX 3080,
you can use that to accelerate text rendering in the Windows Terminal.
I'm not sure that justifies the purchase by itself, though; and no telling your mum
I said you need it for homework! In all honesty, the performance bottleneck is
probably going to be the shell end and not the terminal.
I do vaguely recall a script years ago that actually ran faster with the
command prompt minimised, because it didn't have to draw the text;
but even dumping text out as fast as i could, I couldn't see
any performance difference between the old Console and the new Terminal on my
current system. So I'd look at this more as a feature
that will make your terminal prettier, rather than something that'll make your
scripts faster. More efficient scripting and multi-threading is what will really
make a difference to your script performance.
Before I go, it would be remiss of me not to mention that the old Windows Console
does support some graphical customisation, too. Hence why PowerShell
normally opens with a blue window instead of a black one.
Admittedly, it's nowhere near as customisable as the new Terminal,
but you can guarantee if i don't mention it, someone in the comments
will. Speaking of which... if you find a useful customisation for the Windows
Terminal, let us know in the comments. While you're
waiting for your fancy new terminal to download, why don't you go and check out
one of these videos over here. It actually doesn't take very long to
download; but you should watch those videos anyway, because YouTube said so.
If you found this video useful, then give it a thumbs-up before you go;
and don't forget to subscribe for future videos. Thanks for watching, guys.
See you next time!