终端还是控制台还是Shell还是命令提示符? [英] Terminal or Console or Shell or Command Prompt?

查看:190
本文介绍了终端还是控制台还是Shell还是命令提示符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现自己可以互换使用这些术语,却不知道它们之间的区别。
所有这些术语之间的实际区别是什么?

I find myself using these terms interchangeably without knowing the difference.
What is the actual difference between all these terms?

推荐答案

是的,关于这些术语有很多困惑。我给它一个刺,但是附带条件是这确实是语义,并且这些术语在日常语音中可以互换使用:

Yes, there is a lot of confusion about these terms. I'll give it a stab, but with the proviso that this is really semantics and the terms are used interchangeably in everyday speech :

Shell是用于任何运行其他程序的程序。它环绕另一个程序,因此得名。因此,例如,即使很少有人称它为Windows Explorer,它也是一个外壳。在我使用的所有语言和平台中,任何程序都可以是shell。

"Shell" is the term used for any program which runs others. It wraps around another program, hence its name. So for example, Windows Explorer is a shell, even though very few people would call it one. In all the languages and platforms I have used, any program can be a shell.

编辑:我没有定义终端。它的名称来自与用户沟通的终点。具体来说,它是用于最终用户通信的打字机设备。如今,它变得更加通用,可以表示伪终端(Linux中的pts ps -ef ),这是一个基于字符的会话由GUI管理。在Windows上,这称为控制台窗口。

I did not define a "terminal". It gets its name from being the end-point of communication with the user. Specifically it was the typewriter device used for end-user communication. Today it is rather more general, and can mean a pseudo-terminal (pts in Linux ps -ef), which is a character-based session managed by a GUI. On Windows this would be called a "console window".

控制台表示Windows和UNIX上的特定功能,但有所不同。最初在UNIX上,实际上是tty(TeleTYpewriter,VDU是玻璃电传打字机)插入到计算机中,甚至没有通过加密狗插入(我在UNIX上使用了很长时间)。它是发送和接收启动和关闭消息以及PANIC等警报的终端。 bash和Korn Shell脚本都可以作为伪守护程序运行,而无需TTY /控制台。

"Console" means something specific, but different, on Windows and UNIX. On UNIX originally it was the tty (TeleTYpewriter, a VDU was a "glass teletype") that was physically plugged into the machine, not even via a dongle (I go back a long way with UNIX). It was the terminal that sent and received startup and closedown messages, and alerts such as PANICs. Both bash and Korn shell scripts can run as pseudo-daemons without a TTY/console.

术语控制台通常与更准确的标准输入混淆,标准输出和标准错误(来自C的stdin,stdout,stderr)。这些有时称为流,并且默认情况下将其定向到大多数系统上的终端。在UNIX上,它们是前三个文件描述符,在Windows上,它们是前三个文件句柄,分别为0、1、2。程序可以将它们定向到具有适当访问权限的任何文件系统,但通常不会—经常从其父进程继承它们(并非所有操作系统过去都这样做)。

The term "console" is often confused with the more accurate "standard-input", "standard-output", and "standard-error" (stdin, stdout, stderr, from C). These are sometimes known as streams, and are defaulted to be directed to a terminal on most systems. On UNIX they are the first three file-descriptors, on Windows the first three file handles, 0, 1, 2 on both. A program can direct these to any file system to which it has appropriate access, but usually it does not - it often inherits them from its parent process (not all OSs did this in the past).

在Windows上,控制台程序是具有控制台窗口的程序,通常被错误地称为 DOS框。因此,cmd.exe是一个控制台程序,perl.exe也是如此,python.exe也是如此(但pythonw.exe不是)。

On Windows, a "Console" program is one which has a console window, often incorrectly known as a "DOS box". So, cmd.exe is a console program, but so is perl.exe, and so is python.exe (but not pythonw.exe).

命令提示符为由命令行解释器或CLI显示的键入邀请。按照UNIX上的约定,对于除root以外的所有用户,它以$结尾,而root以#结尾。 csh不遵循此约定,而是使用%。通常,Windows CLI上的提示以>结尾。在所有情况下,这些都可以由用户更改。

A command prompt is the invitation to type which is displayed by a Command Line Interpreter, or CLI. By convention on UNIX it ends with a $ for all users except root, which ends with a #. csh does not follow this convention and uses a %. Generally the prompt on a Windows CLI ends with a >. In all cases these can be altered by the user.

我相信Windows上cmd.exe的快捷方式和窗口标题带有标签 Command Prompt,因为它可以访问命令提示符。我有一本叫做 Windows命令行的Microsoft出版社书,上面写着通过命令行窗口访问命令行。因此,即使Microsoft也混用了他们的条款。

I believe that the shortcut and window title for cmd.exe on Windows has the label "Command Prompt" because it gives access to a command-prompt. I have a Microsoft Press book called "Windows Command-Line" which says "The command line is ... accessed through the command shell window". So even Microsoft mix their terms.

因此,cmd.exe是一个外壳程序,一个CLI和一个控制台程序。 sqlplus是一个CLI,但不是Shell,在Windows上它是一个控制台程序。 Windows资源管理器是一个外壳程序,而不是CLI或控制台程序。 Bash和Korn外壳程序都是具有CLI的外壳程序,可以从控制台运行,但不能完全从控制台运行。

So, cmd.exe is a shell and a CLI, and a console program. sqlplus is a CLI but not a shell, on Windows it is a console program. Windows Explorer is a shell but not a CLI or a console program. Bash and Korn shell are both shells that have a CLI, and can be run from a console, but not exclusively so.

这篇关于终端还是控制台还是Shell还是命令提示符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆