TTY and its Evolution
TTY stands for teletype, a device that let you type in and send commands remotely to the computer and execute them. Its development history is well described on this article , with some useful commands of checking and switching TTY devices on modern Linux system. Based on the article, I draw the following figure to depict my understanding of TTY’s development.
To illustrate what the traditional teletype (mentioned as video teletype on the above figure) may look like, take the DEC VT100 as an example:
Terminal vs. Console
On today’s Linux system, normally we would have following device files:
-
/dev/pts/...
: PTS or Pseudo-Teletypes, software emulation of teletype, interfaced with the pseudo-teletype multiplexor (/dev/ptmx
). For instances:- GUI applications
- SSH client
- Screen and Tmux
-
/dev/tty{,S,USB,AMA}[0-63]
: TTYs or virtual teletypes, simulating traditional teletypes by using modern hardware, including:- Keyboard for input and Hi-Res screen for output (
tty[0-x]
) - Serial line (
ttyS[0-x]
), or over USB device (ttyUSB[0-x]
) - ARM-specific serial line (
ttyAMA[0-x]
)
- Keyboard for input and Hi-Res screen for output (
As summarized in this answer :
- terminal = text input/output environment
- console = physical terminal
- shell = command line interpreter
Any of the above device files can provide a terminal, which is basically an interactive text I/O environment. Physical terminals (/dev/tty*
) are also called consoles, and the primary console detected by the system will be bound to /dev/console
and be interactive, while the others will only show kernel output or even do nothing.
Consoles can be configured via the console=
kernel command line, which, according to the kernel doc: Linux Serial Console
, can be used as follows:
- Multiple
console=
can be specified, while the last one is the primary console (i.e. bound to/dev/console
). - Only one console per device type (e.g. serial, video) can be defined.
- If not specified, the kernel would first look for a video card and then for a serial port to set up the primary console.
For more details about primary and other consoles, read through the kernel doc: Linux Serial Console .
References
- What is a TTY on Linux? (and How to Use the
tty
Command) - Accepted answer of this question on AskUbuntu about the difference between “terminal”, “console” and “command line”.