Authors Top

If you have a few years of experience in the Linux ecosystem, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

1. Introduction

We use the words terminal, shell, tty, and console very regularly while working with computers and more so with Linux systems.

In this tutorial, we’ll look at the difference between these words. For every word, we’ll look at how it originated historically and how we use the word in the modern sense.

2. Historical Background

In the old days, most computing systems had large, centralized processing units known as mainframes. Each of these mainframe machines could have multiple interfaces connected to them. These interfaces consisted of sets of input and output devices. The output devices were usually text-based, though they could be graphical sometimes. In addition, the interfaces could have varying levels of access, from basic functionality to OS administration:

IBM System Z9 type 2094 inside

Picture: IBM System Z9 mainframe computer (Author: Ing. Richard Hilber)

3. Terminal

Originally, the word terminal was used to refer to certain physical hardware devices that were used to send inputs to and read outputs from a computing device. These devices were electronic or electromechanical in nature. They were usually connected to external computing devices such as mainframe computers. The input device was similar to a typewriter which slowly evolved into the modern keyboard. The output devices were initially hard-copy printers. They printed the output on paper. Monitor-like electronic displays replaced the hard-copy printers in the later years:

IBM 2741

Picture: IBM 2741 terminal

On modern-day computers, we usually use the word terminal to refer to software programs known as terminal emulators. These programs emulate the old-day terminals on a personal computer by providing a similar loop-based input-output interface. Examples of such programs include gnome-terminal, xterm, and terminator.

4. Console

A console is a physical device that facilitates the interaction with a computing device that is particularly used for system administration. In other words, a console is a special kind of terminal that is directly connected to the mainframe and used for maintenance tasks. For example, we would typically use a console for interacting with the administrative parts of the system, such as the bootloader, kernel, and the system logger. On the PCs, the console would consist of the keyboard and monitor taken together:

IBM 701

Picture: Operator’s console for an IBM 701 (CC BY 2.0 – Dan – Flickr)

A virtual console is a software program that provides console-like access to the system on Linux. In the early days of Linux development, some developers used the terms virtual terminal and virtual console interchangeably. When we go by the old definition of a console as a device directly connected to the mainframe computing device, we can classify all virtual consoles as virtual terminals, but the converse is not true. Virtual terminals such as xterm or sshd have layers of abstraction between them and the system and therefore cannot be classified as virtual consoles.

5. TTY

The TTY was originally an acronym for the teletypewriter device, which came into use in the mid-1800s. This device sent the typed characters as electrical signals to distantly located devices such as printers. Later, when mainframe computers needed input and output devices, these teletypewriters readily served that purpose:

ASR 33 1

Picture: A Teletype Model 33 ASR teleprinter, usable as a terminal (CC BY 2.0 – Dominic Alves from Brighton, England)

In the Linux world, tty refers to an interface that enables access to the terminal. For example, we can find a bunch of tty files under the /dev directory on Linux:

$ ls -l /dev | grep tty
crw--w----  1 root tty       5,   1 Jun 20 06:35 console
crw-rw-rw-  1 root tty       5,   2 Jun 20 11:30 ptmx
crw-rw-rw-  1 root tty       5,   0 Jun 20 06:35 tty
crw--w----  1 root tty       4,   0 Jun 20 06:35 tty0
crw--w----  1 root tty       4,   1 Jun 20 06:35 tty1
crw--w----  1 root tty       4,  10 Jun 20 06:35 tty10
crw--w----  1 root tty       4,  11 Jun 20 06:35 tty11
...more tty files

These ttys may be virtual terminals or directly connected to a serial port. In essence, they are an abstraction for interfaces that send and receive characters from the main computing system.

6. Shell

A shell is the main interface that we would see when we log in to an operating system. Its main purpose is to help us launch other programs. Unlike the other terms we looked at, there is no hardware predecessor to this term. Instead, it may have evolved as an analogy to the turtle’s shell – which is a ‘home environment’ for the animal:

brand, font, text, presentation, fedora, screenshot, os, linux, operating system, command shell, xen

Picture: The Linux shell output while booting.

In Linux, we usually use the word shell to refer to the main command-line interface on which we run commands and execute applications. Examples of different shells include bash, cshksh, and zsh. We also use the word ‘shell’ to refer to interfaces to interpreted programming languages such as python.

7. Conclusion

In this article, we see that the terms console, terminal, and tty are very closely related. We use them to refer to physical devices or emulated interfaces that send input to and display output from computing machines.

On the other hand, the shell is a software interface that interprets user inputs and runs other programs accordingly while sending their output back to the display devices.

Authors Bottom

If you have a few years of experience in the Linux ecosystem, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

Comments are closed on this article!