Scott Hanselman

What's the difference between a console, a terminal, and a shell?

September 20, 2019 Comment on this post [14] Posted in Linux | Open Source | Win10
Sponsored By

I see a lot of questions that are close but the questions themselves show an underlying misunderstanding of some important terms.

  • Why would I use Windows Terminal over PowerShell?
  • I don't need WSL for bash, I use Cygwin.
  • Can I use conemu with PowerShell Core or do I need to use Windows Terminal?

Let's start with a glossary and clarify some words first.

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 inputing that text into a computer. When that computer replies, you'll see the typewriter automatically type on the same paper.

Photo by Texas.713 used under CC

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.

image

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

Here's an important point that should make more sense now that you have these terminals - Your choice of shell doesn't and shouldn't dictate your choice of terminal application.

Aside: WSL and WSL2 (the Windows Subsystem for Linux) are a complete local Linux (or many Linuxes) that run on Windows 10. They are full and real. WSL2 ships a real Linux kernel and runs in on Windows. Cygwin is NOT a Linux. Cygwin is a large collection of GNU and Open Source tools which provide functionality similar to Linux on Windows - but it is not Linux. It's a simulacrum. It's GNU utils compiled against Win32. It's great, but it's important for you to know what the difference is. Cygwin may let you run your bash shell scripts but it will NOT run Apache, Docker, or other real ELF-binaries and Linux apps.

Your Choice of Windows Consoles?

There are a number of shells that ship with Windows. Here's a few I'm running now. Note the "chrome" or the border and title around them? Those shells are all hosted by a the legacy Windows console you have never heard of called conhost.exe. You can go to the command prompt, type powershell, cmd, or ubuntu and any number of shells will run. Conhost does the work of input and output.

Now, forget that conhost exists, because it sucks - it's super old.

Shells that come with Windows

Pseudo Console, Pseudo Terminal, PTY, Pseudo TTY (ConPTY)

Pseudo Terminals are terminal emulators or software interfaces that emulate terminals. They pretend to be terminals like the ones above. *Nix systems have long had a pseudo-terminal (PTY) infrastructure and now Windows as a pseudoconsole (ConPTY) as well.

Window's new ConPTY interface is the future of consoles and terminals on Windows. If you choose a 3rd party (non-built-in) console applications for Windows, make sure it supports ConPTY and it'll be a better experience than some of the older consoles that use screen scraping or other hacks.

image

Back to your choice of Windows Consoles

Remembering there's a lot of shells you can use in Windows, there's a lot of 3rd party consoles you can use if you don't like conhost.exe (and you shouldn't).

All of these Terminals support ALL the shells above and any shells I've missed. Because a shell isn't a terminal. Pick the one that makes you happy. I use PowerShell Core and Ubuntu in WSL2 in the Windows Terminal.

Windows Terminal

Hope this helps clear things up.


Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
September 23, 2019 13:10
This is a really, really common confusion that people have. Surprisingly, I've noticed it just as often from Linux people as I do from Windows people. It's good to lay the terminology/concepts out there and make things clearer for people.
September 23, 2019 13:46
I am afraid these definitions don't match what I learned during the official Microsoft training. (I am referring to MCSE, but I don't suppose anyone knows what it is.)

The contemporary definition of Shell is the user interface that exposes OS services to the user. It could be either graphical (e.g. Unity, Windows Shell) or text-based/command-line (e.g. Bash, PowerShell) "Shell" also has another less popular meaning: A software front-end of something (e.g. an Internet Explorer shell.)

Console, in Microsoft's definition, has two meanings. The widespread meaning is the set of input and output devices that operate a computer: Monitor and human interface devices (keyboard, mouse, touchpad, pen, touch screen) Remote Desktop Services uses "console" in this sense. (Even heard the phrase "to log in via console" vs. "remote login"?) The rest of the world, however, defines "console" as the input and output device for text only. Hence, a console app is a TUI app.

ConHost.exe is neither old nor legacy software. It was introduced with Windows 7. The latest version of Windows 10 (1903) uses it. Before Windows 7, csrss.exe rendered Windows TUI.

Finally, I don't see how any of these answer the three bullet points at the top. PowerShell is a scripting language, a terminal, a shell, and a backend all at once. Windows Terminal is just a terminal. Hence, the first question is valid. Earlier versions of ConEmu also did not come with PowerShell Core pre-configured in them. And Cygwin is a great alternative to WSL for running Bash if Bash is all one wants. (That bullet point is not even a question.) According to Microsoft Craig Loewen, WSL 2 needs a 64-bit system, SLAT, Hyper-V, etc.
September 23, 2019 15:59
First image is a telex machine not really a terminal, note the phone dial pad on the RHS. Is a telex machine connected to a computer? or just sending text messages over a telephone line. Wikipedia https://en.wikipedia.org/wiki/Computer_terminal has some nice pics?
September 23, 2019 18:27
7 - Fleet, I hear what you’re saying, but I personally work with the console team Microsoft weekly, I guarantee you that conhost is well on the way out. You point out it ships with Windows 7 - that is a 10-year-old product is leaving Support in April of next year. It’s legacy. The one shipping with win10 is used, but Windows Terminal and ConPTY is the future.

PowerShell isn’t a console or a terminal. It’s not doing any window management or painting. Conhost OR Windows Terminal does that work and PowerShell remains headless.

As for “Shell” I’m referring to text shells, not graphical ones like explorer.

Sean - a telex connected to a computer is a TTY and the simplest possible Terminal.
September 23, 2019 19:27
One distinction I think is missing is that a terminal typically supports communication to a remote computer over a serial (or Telnet) connection.

It would be nice to be able to take advantage of the improved VT100 emulation of the new console and connect via USB/Serial (COMx:) to my Altair-Duino and PiDP-8 computers.
September 24, 2019 7:01
For me:

Console: physically attached I/O (keyboard and screen) to which boot and default "con" output goes to. It's where boot info showed, admin alerts, etc. This is from using VAX VMS and Unix in college on both dumb VT terminals and early Sun workstations. The console was almost always located behind locked doors, in close proximity to the computer itself.

In early PC days, when you could only have one MS-DOS command interpreter open, it made sense that this command line interface was also the console (and why things like copy con worked). Also, like a console on a big computer, you had complete access to the whole thing through this interface.

Terminal: Remote session to the computer, typically over serial or sockets, either in a window on a computer or a dedicated device like the VT220s I loved to use. These were located all over campus.

FWIW, we also had a few teletype terminals on the floor in the labs, even though they were ancient by then. In college, I played Adventure (the FORTRAN version), on a teletype connected to DEC VAX VMS, in college. :)

Shell: the interaction environment delivered by the computer: DCL, bash, csh, command.com, cmd.exe, powershell.exe, etc. Could also be graphical now, of course. But it provides a way to get to user applications on the computer. Anything beyond that is gravy.

The definitions have evolved over time, and get muddy when you're talking about all three on a single device, but in my head, I tend to stick to what I learned in college back in the day.

Pete
September 24, 2019 9:28
Cygwin is not a shell, but a Unix emulation layer on top of Windows. I.e. it accepts POSIX APIs and translates them to the Windows API.

As such it comes with a couple of shell options, bash being the default. But you can use zsh etc. as well.
September 24, 2019 11:50
@Scott: Well, thank you for the reply. Now, when you say ConHost is being deprecated, I remember all the things that Microsoft initially designated as "deprecated" in the past, only to remain with us past their due date. Microsoft Paint is the most recent example. So, I'm afraid I'll believe it when I see it.

Also, it was amusing that you're referring to me as "7 - Fleet"! 😜 It's kinda cute.
September 24, 2019 13:44
@FleetCommand: deprecated doesn't mean removed, though. Microsoft generally goes to a great deal of trouble to ensure backwards compatibility so it's not a shock that things stick around while people are still using them. Look at how long it took them to disable SMB1 by default in Windows, while they had basically been begging people to stop using it for years. conhost.exe isn't going anywhere in the near future, but it's pretty clear that the development focus is on the new terminal. My understanding is they plan to make it the default in some future build of Windows 10.
September 24, 2019 15:43
@Lachlan Picking: Nitpick all you want, my friend, but Microsoft Paint was supposed to have been eliminated from the Windows image and moved to Store. And ConHost.exe has not been deprecated, discontinued, removed, replaced, unsupported or anything.

And most importantly, one can never be sure that a new Windows 10 feature is actually superior to a Windows 7 feature. Not before seeing it. Ever tried installing Fiddler for in the context of a Standard user account and then uninstall it using Apps and Features? If yes, you know what I mean.
September 25, 2019 0:45
@FleetCommand: I don't think I'm nitpicking any more than you were in your original comment. You tried to argue with Scott that conhost is neither old nor legacy. It's absolutely old, because even if the conhost.exe process specifically has only been around since Windows 7 or Vista (which as Scott points out, is already a decade), the underlying code-base is much older. According to Rich Turner, it was one of the first GUI apps written during NT's development circa 1989, making it closer to 30 years old.

As for whether it's legacy, well that depends on what legacy means, I guess. If by legacy we mean "still present/supported due to wide-spread use, but something newer has come along to serve the same purpose" then I think that pretty accurately describes conhost.exe going forward. Importantly, I don't think "legacy" is the same as deprecation, and neither Scott nor anyone at Microsoft that I know of has said conhost is deprecated and I don't think that's likely to change as long as it's still in wide use. In fact, the team explicitly said as much:

Windows Console will continue to ship within Windows for decades to come in order to ensure backward compatibility with the many millions of existing/legacy command-line scripts, apps, and tools


But as I said before, the development focus (especially when it comes to new features) is going to be on the new Terminal, not conhost. That's clear from the way the code-base has been restructured, the work that has been done so far, and comments made by people on the command-line team. And that's really all Scott was saying: let's talk about the new terminal because the existing console is old and it does suck.
September 25, 2019 13:56
Is that posh-git in the last screenshot? How did you make it look so good?
September 25, 2019 18:19
@Ashish Check out the previous post where he explains it in detail.
September 27, 2019 21:12
I think I'm with Sean Creighton, what is "a telex connected to a computer" and how is that relevant? Telex/TWX is a term for the system as a whole and must have been used by users to refer to the messages as well. I don't think it is an ASR-32 either, it looks more like an ASR-33 with a CCU.

Pete has a more accurate description of consoles. These have special properties on the computer otherwise they are just a terminal line. The IBM PC may have had a shaky story as it transitioned to being a server-class machine but on proper computers the console gives you (out-of-band) access to privileged operations like halting/rebooting the machine, choosing the boot device, hardware diagnostics, direct login to administrator accounts, critical system logging including kernel panics/watchdog reboots.

Even Windows has the concept of a secure attention sequence. And have a look above those cursor keys on a typical PC keyboard, the break key lives on even if it's changed key!

I also remember a story about the implementation for serial connections sometimes using very simple polled I/O operations to try and keep the console working regardless of other system activity/bugs, perhaps that's from the mainframe era.

I can report copy con: filename still works on Windows! No ctty though :(

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.