terminal(终端),shell,tty,console(控制台)区别
原文地址 stackexchange:What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?
(原文wiki链接在翻译中替换为百度百科链接。)
A terminal is at the end of an electric wire, a shell is the home of a turtle, tty is a strange abbreviation and a console is a kind of cabinet.
终端在电线的末端,壳是乌龟的家,tty是一个奇怪的缩写,控制台是一种柜子。
Well, etymologically speaking, anyway.
从词源学上讲,是这样。
In unix terminology, the short answer is that
在unix术语中,简短地回答是:
- terminal = tty = text input/output environment
- console = physical terminal
- shell = command line interpreter
- terminal(终端) = tty = 文本输入/输出环境
- console(控制台) = 物理终端
- shell(壳) = 命令行解释器
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, that meant a teleprinter-style device resembling a typewriter, sometimes called a teletypewriter, or “tty” in shorthand. 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.
控制台,终端和tty联系密切。最初,它们代表一台可以与计算机进行交互的设备:在unix的早期,它代表(teleprinter)电传打字机-外形类似打印机,也叫teletypewriter,或者缩写为"tty"。“终端”是从电子的角度看,“控制台”是从设备的角度看。在unxi的最初阶段,键盘和显示器成为终端的标准。
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 its most common meaning, terminal is synonymous with tty. Some ttys are provided by the kernel on behalf of a hardware device, for example with the input coming from the keyboard and 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, are provided (through a thin kernel layer) by programs called 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 terminal on one machine with programs on another machine), Expect (for scripting terminal interactions), etc.
在unxi术语中,tty是一种特殊的设备文件,它实现了一些额外的读写命令(ioctls,io设备控制函数)。一般,终端与tty同义。内核提供了一些代表硬件设备的tty,例如来自键盘的输入和到文本模式屏幕的输出,或在串行上传输的输入输出流。另一种tty,有时也被称为伪tty,是通过终端模拟器程序提供的(通过一个核心层),终端模拟器程序包括如Xterm(运行在X Windox System),Screen(提供了一个程序与另一个终端之间的独立中间层),SSH(在一台机器上连接另一台机器的终端的程序),Expect(脚本终端交互)等等。
The word terminal can also have a more traditional meaning of a device through which one interacts with a computer, typically with a keyboard and display. For example an X terminal is a kind of thin client, a special-purpose computer whose only purpose is to drive a keyboard, display, mouse and occasionally other human interaction peripherals, with the actual applications running on another, more powerful computer.
terminal这个词还有一个更传统的意思,它表示一台可以与计算机交互的设备,通常是键盘和屏幕。例如X terminal是一种瘦客户端,瘦客户端是一种特殊用途的计算机,它的唯一目的是驱动键盘,显示器,鼠标以及一些其它的人机交互外设,实际的程序运行在另一台更强大的计算机上。
A console is generally a terminal in the physical sense that is 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 these ttys); just to confuse matters, the name given to each particular tty can be “console”, ”virtual console”, ”virtual terminal”, and other variations.
控制台通常是物理意义上的终端,一个直接连接到机器上的主终端。控制台在操作系统上通常表现为一个(内核实现的)tty。在一些系统中,如Linux和FreeBSD,控制台表现为多个tty(通过特定的组合键在tty之间切换),让人混乱的是,每个特定的tty的名称可以是"console"(控制台),"virtual terminal"(虚拟终端)等等。
See also Why is a Virtual Terminal “virtual”, and what/why/where is the “real” Terminal?.
参考Why is a Virtual Terminal “virtual”, and what/why/where is the “real” Terminal?.
A shell is the primary interface that users see when they log in, whose primary purpose is to start other programs. (I don't know whether the original metaphor is that the shell is the home environment for the user, or that the shell is what other programs are running in.)
shell(壳)是用户登录系统时看到的主界面,它主要的作用是启动其它程序。(我不知道原来的喻义是指shell是用户的home环境,还是shell是其它程序的运行环境。)
In unix circles, shell has specialized to mean a command-line shell, centered around entering the name of the application one wants to start, followed by the names of files or other objects that the application should act on, and pressing the Enter key. Other types of environments don't use the word “shell”; for example, window systems involve “window managers” and “desktop environments”, not a “shell”.
在unix圈中,shell特指命令行shell,围绕输入想要启动的程序名称,后面跟着文件名或者其它应用程序需要知道的东西,然后按回车键。其它类型的环境不使用"shell"这个词;例如,窗口系统包括"窗口管理器"和"桌面环境",而不是"shell"。
There are many different unix shells. Popular shells for interactive use include Bash (the default on most Linux installations), zsh (which emphasizes power and customizability) and fish (which emphasizes simplicity).
有很多不同的unix shell。流行的交互式shell包括Bash(大多数Linux默认安装),zsh(注重功能和可定制性),fish(注重简单)。
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 have a common syntax based on the Bourne_shell. When discussing “shell programming”, the shell is almost always implied to be a Bourne-style shell. Some shells that are often used for scripting but lack advanced interactive features include the Korn shell (ksh) and many ash variants. Pretty much any Unix-like system has a Bourne-style shell installed as /bin/sh
, usually ash, ksh or bash.
命令行shell包括了组合命令的流程控制结构。除了在交互式提示符中键入命令外,用户还可以编写脚本。大多数shell使用一套基于Bourne_shell的语法。当讨论"shell编程"是,shell通常指Bourne-shell风格的shell。一些shell经常用来运行脚本但是缺少高级的交互特性,包括the Korn shell(ksh)和ash的变种。几乎所有的类Unix系统都有一个Bourne-style的shell安装在/bin/sh,通常是ash,ksh或者bash。
In unix system administration, a user's shell is the program that is invoked when they log in. Normal user accounts have a command-line shell, but users with restricted access may have a restricted shell or some other specific command (e.g. for file-transfer-only accounts).
在unix系统管理中,一个用户的shell是指他们登录时被调用的程序。普通用户拥有一个命令行shell,但限制权限的用户会拥有一个restricted shell或者只能运行特定命令的shell(如仅用于文件传输的账户)。
The division of labor between the terminal and the shell is not completely obvious. Here are their main tasks.
terminal(终端)和shell的分工并不十分明显。它们的主要任务:
- 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
). - 输入:terminal将键盘操作转换为控制序列(如 Left -> \e[D)。shell将控制序列转换为命令(如 \e[D -> backward-char)。
- Line edition, input history and completion are provided by the shell.
- The terminal may provide its 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 that operates in this way is
M-x shell
in Emacs.
- The terminal may provide its 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 that operates in this way is
- 行编辑,输入历史和补全是shell提供的。
- terminal可能会提供自己的行编辑,输入历史和补全,并且只在准备执行命令的时候将命令发送给shell。主流的terminal中唯一这样做的是Emacs中的M-x shell。
- Output: the shell emits instructions such as “display
foo
”, “switch the foreground color to green”, “move the cursor to the next line”, etc. The terminal acts on these instructions. - 输出:shell发出指令如"display foo", “switch the foreground color to green”, “move the cursor to the next line”等,终端响应这些指令。
- The prompt is purely a shell concept.
- 提示符是shell中的概念。
- The shell never sees the output of the commands it runs (unless redirected). Output history (scrollback) is purely a terminal concept.
- shell中看不到它运行的命令的输出(除非重定向)。输出历史(回滚)是terminal中的概念。
- Inter-application copy-paste is provided by the terminal (usually with the mouse or key sequences such as Ctrl+Shift+V or Shift+Insert). The shell may have its own internal copy-paste mechanism as well (e.g. Meta+W and Ctrl+Y).
- 应用程序之间的复制粘贴是terminal提供的(通常用鼠标或键盘组合如: Ctrl+Shift+V 或 Shift+Insert)。shell也有自己的内部复制粘贴机制(如 Meta+W and Ctrl+Y)。
- Job control (launching programs in the background and managing them) is mostly performed by the shell. However, it's the terminal that handles key combinations like Ctrl+C to kill the foreground job and Ctrl+Z to suspend it.
- 作业控制(在后台启动程序并管理程序)主要有shell执行。然而,terminal处理组合键如Ctrl+C 来终止前台程序, Ctrl+Z来挂起前台程序。
扩展阅读:
CSDN:控制台,终端,虚拟终端,tty,shell等概念的区别
terminal(终端),shell,tty,console(控制台)区别的更多相关文章
- 【转】控制台,终端,tty,shell等概念的区别
转自:http://www.2cto.com/os/201403/282583.html http://blog.sina.com.cn/s/blog_bcdac52b0101i2r1.html 控制 ...
- 命令行界面 (CLI)、终端 (Terminal)、Shell、TTY的区别
虽然这个话题已是老生常谈,搜索一下应该也能找到大把的相关文章.不过难得提到了这方面,就趁此机会把我的理解写下来,一来看看我是不是真正理解了,二来看看我能不能把它们之间的区别讲得更加简明易懂. 0. 太 ...
- 【转】linux下tty,控制台,虚拟终端,串口,console(控制台终端)详解----不错
原文网址:http://blog.csdn.net/liaoxinmeng/article/details/5004743 首先: 1.终端和控制台都不是个人电脑的概念,而是多人共用的小型中型大型计算 ...
- Linux中终端和控制台区别
Linux中终端和控制台区别: 终端:英文名叫terminal 控制台:英文名叫console 两者区别要从以前的多人使用的计算机开始 以前,由于计算机很昂贵,所用一台计算机一般由多个人同时使用.这样 ...
- (Linux基础学习)第三章:terminal与shell的简介和修改命令提示符颜色
第1节:terminal终端设备终端:键盘.鼠标.显示器物理终端(/dev/console):控制台console虚拟终端(tty:teletypewriters,/dev/tty# #为[1-6]) ...
- Firebug & Chrome Console 控制台使用指南
转自:http://visionsky.blog.51cto.com/733317/543789 Console API 当打开 firebug (也包括 Chrome 等浏览器的自带调试工具),wi ...
- eclipse中的Console控制台视图脱离主窗口解决办法
问题:Console控制台视图由于操作不当,跑出来了,脱离了主窗口 解决:在eclipse主窗口最上面的工具条选项中,找到Window,点击里面的Reset Perspective,即可,这样视图就重 ...
- phpStorm如何在Console控制台执行php文本,而不是浏览器中
如何在Console控制台执行php文本 phpStorm默认会在浏览器中执行脚本 默认的配置 配置PHP脚本 扩展,配置项目运行
- console控制台的小问题
第一个foo里面应该是123,但是当执行完下面的代码之后,console控制台会自动将里面的内容改成我们修改之后的
随机推荐
- 使用SQL Server维护计划实现数据库定时自动备份
在SQL Server中出于数据安全的考虑,所以需要定期的备份数据库.而备份数据库一般又是在凌晨时间基本没有数据库操作的时候进行,所以我们不可能要求管理员每天守到晚上1点去备份数据库.要实现数据库的定 ...
- ajax请求node.js接口时出现 No 'Access-Control-Allow-Origin' header is present on the requested resource错误
ajax请求node.js接口出现了如下的错误: XMLHttpRequest cannot load http://xxx.xxx.xx.xx:8888/getTem?cityId=110105&a ...
- HeapByteBuffer和DirectByteBuffer以及回收DirectByteBuffer
由于HeapByteBuffer和DirectByteBuffer类都是default类型的,所以你无法字节访问到,你只能通过ByteBuffer间接访问到它,因为JVM不想让你访问到它. 分配Hea ...
- GC日志介绍
每一种收集器的日志形式都是由它们自身的实现所决定的,换而言之,每个收集器的日志格式都可以不一样.但虚拟机设计者为了方便用户阅读,将各个收集器的日志都维持一定的共性,例如以下两段典型的GC日志: 33. ...
- C# 中的可变参数方法(VarArgs)
首先需要明确一点:这里提到的可变参数方法,指的是具有 CallingConventions.VarArgs 调用约定的方法,而不是包含 params 参数的方法.可以通过MethodBase.Call ...
- Linux基础命令(1)
使用Ctr + Alt + F1(2,3,4,5,6)进入终端. 使用Ctr + Alt + F7回到界面. date 显示系统日期 cal 2015 显示2015年的日历表 reboot 重启 sh ...
- Square Coins[HDU1398]
Square Coins Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
- 不通过App Store,在iOS设备上直接安装应用程序(转)
今天在iOS设备上安装天翼云存储app,在safari上直接打开http://cloud.189.cn/wap/index.jsp,点击“点击免费安装”,如下图: 神奇的事情发生了,设备上直接下载ap ...
- [Unity2D]预制件Prefab
预制件Prefab是一个组件模板,比如在游戏里面要实现开枪的时候会有子弹不停地从枪口飞出来,那么就可以通过Prefab来实现子弹的游戏对象,表示所有的子弹都是从同一个Prefab来构建出来的,也可以理 ...
- winform学习之----打开文件对话框并将文件内容放入文本框
OpenFileDialog ofg = new OpenFileDialog(); ofg.Title = "ddd";//设置对话框标题 ofg.Multiselect = t ...