Terminal (terminal), Shell,tty,console (console) Difference

Source: Internet
Author: User



Differences in concepts such as consoles, terminals, virtual terminals, Tty,shell, etc.


What is the exact difference between a ' terminal ', a ' shell ', a ' tty ' and a ' console '?


A terminal is at the end of a electric wire, a shell was the home of a turtle, TTY is a strange abbreviation and a console is a kind of cabinet.



Well, etymologically speaking, anyway.



In UNIX terminology, the short answer are that


    • Terminal = TTY = text Input/output environment
    • Console = Physical Terminal
    • Shell = Command line Interpreter


Console, terminal and TTY are closely related. Originally, they meant a piece of equipment through which you could interact with a computer:in the early days of UNIX, T Hat meant A teleprinter-style device resembling a typewriter, sometimes called a teletypewriter, or "TTY" in Shorthan D. The name "Terminal" came from the electronic point of view, and the name "console" from the furniture point of view. Very early in UNIX history, electronic keyboards and displays became the norm for terminals.



In Unix terminology, a  TTY  is a particular kind Of device File which implements A number of additional commands (IOCTLs) beyond read and write. In it most common meaning, , terminal  is synonymous with TTY. Some TTYs is provided by the kernel in behalf of a hardware device, for example with the input coming from the keyboard a nd the output going to a text mode screen, or with the input and output transmitted over a serial line. Other ttys, sometimes called  Pseudo-ttys , is provided (through a thin kernel layer) by Programs Cal led  terminal emulators , such as xterm  (running in the x Window System),  screen  (which provides a layer of isolation between a program and another terminal),  ssh (which connects a termin Al on one machine with programs in another machine), expect  (for scripting terminal interactions), etc.



The word terminal can also has a more traditional meaning of a device through which one interacts with a computer, Typica Lly with a keyboard and display. For example an X terminal are a kind of thin client, a special-purpose computer whose only purpose are to drive a keyboard, Display, mouse and occasionally other human interaction peripherals, with the actual applications running on another, more Powerful computer.



A console is generally a terminal in the physical sense that's by some definition the primary terminal directly Connected to a machine. The console appears to the operating system as a (kernel-implemented) TTY. On some systems, such as Linux and FreeBSD, the console appears as several ttys (special key combinations switch between t Hese ttys); Just to confuse matters, the name given to each particular TTY can is "console", "Virtual Console", "Virtual Terminal", an D Other variations.



See also what is a virtual Terminal "virtual", and What/why/where is the "real" Terminal?



A Shell is the primary interface this users see if they log in, whose primary purpose are to start other program S. (I don ' t know whether the original metaphor is the-the-shell is the home-environment for the user, or that the shell I s what other programs is running in.)



In Unix circles, Shell have specialized to mean a command-line shell, centered around entering the name of the app Lication one wants to start, followed by the names of files or other objects that the application should act on, and press ing the Enter key. Other types of environments don ' t use the word "shell"; For example, Windows systems involve "window managers" and "desktop Environments", not a "shell".



There is many different Unix shells. Popular shells for interactive use include Bash (the default in most Linux installations), zsh (which emphasizes power and customizability) and fish (which emphasizes simplicity).



Command-Line shells include flow control constructs to combine commands. In addition to typing commands at an interactive prompt, users can write scripts. The most common shells has a common syntax based on the Bourne_shell. When discussing "Shell programming", the shell was almost always implied to be a bourne-style shell.  Some shells that is often used for scripting but lack advanced interactive features include the Korn shell (Ksh) and many Ash variants. Pretty much any unix-like system have a bourne-style shell installed as/bin/sh, usually ash, ksh or bash.



In Unix system administration, a user's shell is the program, which is invoked if they log in. The Normal user accounts has a command-line shell, but the users with restricted access is a restricted shell or some other Specific command (e.g. for file-transfer-only accounts).



The Division of labor between the terminal and the shell are not completely obvious. Here is their main tasks.


  • Input:the terminal converts keys into control sequences (e.g.Left→\e[D). The shell converts control sequences into commands (e.g.\e[D→backward-char).
  • Line edition, input history and completion is provided by the shell.
    • The terminal may provide their own line edition, history and completion instead, and only send a line to the shell when it ' s Ready to be executed. The only common terminal, operates in this-is inM-x shellEmacs.
  • Output:the Shell emits instructions such as "Displayfoo", "switch the foreground color to green", "move the cursor to The next line ", etc. The terminal acts on these instructions.
  • The prompt is purely a shell concept.
  • The shell never sees the output of the commands it runs (unless redirected). Output history (Scrollback) is purely a terminal concept.
  • Inter-application Copy-paste is provided by the terminal (usually with the mouse or key sequences such asCtrl+Shift+orShift+Insert). The shell may has its own internal copy-paste mechanism as well (e.g.Meta+WandCtrl+Y).
  • Job control (launching programs in the background and managing them) are mostly performed by the shell. However, it's the terminal that handles key combinations likeCtrl+ toCkill the foreground job andCtrl+Zto Suspend it.


Terminal (terminal), Shell,tty,console (console) Difference


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.