What is the exact difference between ternial, shell, TTY and console?

Time:2020-12-20

Original meaning of NOUN

Terminal: the terminal is at the end of the wire,
Shell: the shell is the turtle’s home,
TTY: it’s a strange abbreviation,
Console: a console is a kind of cabinet.

Well, etymologically, that’s it.

In UNIX terms, the short answer is

  • Terminal = TTY = text input / output environment
  • Console = physical terminal
  • Shell = command line interpreter

The following links are from Wikipedia and may need to be crossed

Console, terminal and TTY are closely related. Earlier, they meant a device through which you could interact with a computer: in the early days of UNIX, it meant atelexThe device is similar to a typewriter, sometimes referred to as a teletypewriterteletypewriter, or abbreviated as “TTY”. The name “terminal” comes from the perspective of electronic science. From the perspective of furniture, the name is “console”. In the early days of UNIX history, electronic keyboard and display became the standard of terminal.

The philosophy of UNIX is that everything is a document

Equipment is no exception.

In UNIX terms,ttyIt’s a special oneEquipment documentationIt implements divisionReading and writingMany other commands(ioctls)。 In its most common meaning,terminalIt’s a synonym for TTY. Some TTYs are provided by the kernel on behalf of the hardware device, for example, input comes from the keyboard, output goes to the text mode screen, or input and output are transmitted over a serial line. Other TTY, sometimes calledPseudo TTYIs calledTerminal Emulator For example:

terminalThe more traditional meaning of the word can also refer to a device through which people can interact with computers (usually keyboards and displays). For example, the X terminal is aThin clientIs a dedicated computer whose sole purpose is to drive a keyboard, monitor, mouse, and occasionally other human-computer interaction peripherals, while the actual application program runs on another, more powerful computer.

andConsoleIt is generally in the physical sense, in a sense, it is directly connected to the host terminal. The console is displayed in the operating system as TTY (implemented by the kernel). On some systems, such as Linux and FreeBSD, the console displays as multiple TTYs (special key combinations switch between these TTYs). To confuse things, the names given to each particular TTY can be “console,” “virtual console,” “virtual terminal,” and other variants.

See also Why are virtual terminals “virtual” and what / why / where are “real” terminals?

Shell


OneshellIt is the main interface that users can see when they log in. Its main purpose is to start other programs. (I don’t know if the original metaphor is whether the shell is the user’s home environment or whether the shelln is a shell in which other programs run.)

In UNIX circles,shellSpecifically refers toCommand line shell, centered on the name of the application you want to start, enter the name of the file or other object that the application should work on, and then pressEnterKey. Other types of environments do not use the word “shell”; for example“Window manager”And“Desktop Environment”, not the “shell.”.

There are many different UNIX shells. Popular shells for interactive use include:

  • Bash: default settings in most Linux installations,
  • zsh: emphasis on function and customization,
  • fishEmphasis on simplicity.

The command line shell contains a flow control structure for combining commands. In addition to typing commands at interactive prompts, users can also write scripts. The most common shell is based onBourne_shellThe general syntax of. In discussion“Shell programming”Shell is almost always implied as Bourne style shell. Some are often used for scripting but lack advanced interactivityThe shell ofincludeKorn housing (KSH)And manyashvariant. Almost all UNIX like systems have Bourne style shell installations for/bin/sh, usually ash, KSH, or bash.

In UNIX system management, the user’sShellTheir program is called when they log in. A normal user account has a command-line shell, but users with limited access may haveLimited shellOr some other specific command (for example, for file transfer – account only).


The division of labor between terminal and shell is not entirely obvious. Their main functions are as follows:

  • Input: the terminal converts the key into a control sequence (e.gLefte[D)。 Shell converts the control sequence into a command (for examplee[Dbackward-char)。
  • Shell provides line editing, history input and auxiliary input functions.

    • Instead, the terminal can provide its own line editing, history and completion functions, and send the line to the shell only when it is ready to execute. The only common terminal that runs in this wayM-x shellIn Emacs.
  • Output: the shell issues such as “display”foo””Switch foreground color to green”, “move cursor to next line” and so on. The terminal operates according to these instructions.
  • Prompt is purely a shell concept.
  • The shell will never see the output of the command it runs (unless redirected). Output history (rollback) is purely a terminal concept.
  • The terminal provides copy and paste between applications (usually using a mouse or key sequence, for exampleCtrl+ Shift+VorShift+ Insert)。 The shell can also have its own internal copy and paste mechanism (e.gMeta+WandCtrl+ Y)。
  • Operation control(start the program in the background and manage it) mainly by the shell. However, it is handled by the terminal, such asCtrl+CTo kill the foreground job andCtrl+ZSuspend it.

reference resources

Recommended Today

The default value is displayed when the flutter text box is initialized

At the beginning of the flutter text box, we usedTextField. There seems to be no problem in most cases. The code form is as follows: class _FooState extends State<Foo> { TextEditingController _controller; @override void initState() { super.initState(); _ Controller = new texteditingcontroller (text: ‘initialization content’); } @override Widget build(BuildContext context) { return new Column( children: […]