The Difference Between a Terminal, a Console and a Shell

Table of Contents

Diving deeper into the computer science world, we often come across the terms “terminal”, “console” and “shell”, which seem to be used more or less interchangeably. Is that really the case? And if not, what is the difference between all of these terms?

In order to understand the subtleties of these terms, we need to go back to the very beginnings of computing.

The Terminal

A terminal is simply an end point, a “terminus” of a computer network. It’s a physical device fitted with an input and output.

The very first computers, devoid of screens, used teletypewriters as input/output devices. These teletypewriters (often abbreviated as “TTY”) were the first terminals. Instead of a screen, there was a roll of paper. You’d type instructions which were printed on that paper and simultaneously sent to the computer for processing. Then, the computer would automatically print its output on that same paper.

Some teletypewriter models could save the typed characters by perforating tape. The first software programs were saved and run in this way.

https://www.codequoi.com//images/terminal-shell-console/ASR-33*at_CHM.agr*-1024x768.jpg does not exist

Today, personal computers, computer workstations, smartphones or tablets have largely replaced teletypewriters. In a strict sense, a terminal refers primarily to a physical machine equipped with input/output devices and situated at the endpoint of a computer network.

The Console

In the middle of the 20th century, a piece of furniture complete with keyboard and screen is progressively replacing the teletypewriter. This machine was called a " system console".

IBM 360/85 console of the NSA in 1971. This console is also called a terminal.
IBM 360/85 console of the NSA. January 1971. Source

The console is by definition a terminal in the proper sense of the word. Following this evolution, the term “console” now refers to the device, and the word “terminal” describes the software inside the console.

These days, the terms “terminal” and “console” are, for all intents and purposes, interchangeable.

The Terminal Emulator

Nowadays, the word “terminal” frequently refers to the program that allows us to type command lines in order to interact with the operating system. This software is in reality a terminal emulator, a virtual terminal or console. It simulates a physical terminal, which allows us, among other things, to open several windows and use several of them within a single computer.

The default GNOME terminal emulator in Ubuntu.
The default GNOME terminal emulator in Ubuntu.

Just like the historical teletypewriters, Unix systems sometimes call the terminal emulator “TTY”. The virtual terminal does work in a similar way: the user types a command that is relayed to the operating system, and the result appears in the same window.

Typically, we can use the ctrl + alt + T shortcut to open a terminal window. But there are many different emulators. For example, under Linux: GNOME Terminal, xterm, Terminator, st, Konsole, etc. Under MacOS: iTerm, iTerm2, kitty, ZOC, etc.

However, a terminal isn’t very smart. It doesn’t actually process any commands or scan any files or execute any program itself. Its sole function is to collect the input and display the output. As a matter of fact, the system treats the terminal like a special file, a device file through which it can receive instructions and display results.

In order to interpret and execute the commands we give the terminal, the operating system needs another program: a shell.

The Shell

Usually, Unix operating systems are described with a metaphore: a nut with two layers. The low level layer is called a kernel. That’s the edible, useful part of the nut. This kernel is protected by the high level layer, the nut’s shell. To access the kernel that contains the useful part of the operating system, you inevitably need to go through the shell.

The shell is therefore the software that provides the operating system’s user interface. It can take two forms:

  • CLI: a command line interface in a text environment, where the user interacts with the system by typing commands that the shell interprets and executes.
  • GUI: a graphical user interface that provides a graphical environment like a desktop or start screen, where the user interacts with the operating system usually by clicking on elements.

On the command line, the shell is the program that interprets and processes the commands typed in the terminal. Then, it returns a result to print.

The vast majority of Unix distributions have Bash as their default shell. However, there are many other shells, like for example sh, zsh, ksh, tsch, ash, dash and fish. Some have differences in terms of syntax, others have the same syntax but different features.

Since all of these shells are only different ways to communicate with the operating system’s kernel, they are interchangeable. You could easily install and use a different shell than the one provided by default on your operating system.

Conclusion

When we communicate with an operating system with the command line, we use three different things:

  • the console or terminal, meaning the physical machine at the endpoint of a computer network,
  • the terminal, an input/output program that passes user commands and displays a result,
  • and the shell, a program that provides the interface between users and the central system kernel, to interpret and execute the required commands.

Sources and Further Reading

  • Scott Hanselman, What’s the difference between a console, a terminal, and a shell?[ hanselman.com]
  • Chris Hoffman, What’s the Difference Between Bash, Zsh, and Other Linux Shells? [ HowToGeek.com]
  • Wikipedia, Teleprinter [ Wikipedia]
  • Wikipedia, Shell (computing) [ Wikipedia]

Comments

Related Posts

The Internet's Layered Network Architecture

We all know the Internet. It’s the network that enables data transfer on a global scale.

Read More

Sending and Intercepting a Signal in C

Anyone who’s ever been confronted to segfaults and bus error will already be familiar with the idea of signals.

Read More