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

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

问题描述

我发现自己在不知道区别的情况下交替使用这些术语.
所有这些术语之间的实际区别是什么?

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 :

外壳"是用于运行其他程序的任何程序的术语.它环绕另一个程序,因此得名.例如,Windows 资源管理器是一个外壳,尽管很少有人会称它为外壳.在我使用过的所有语言和平台中,任何程序都可以是 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.

术语控制台"经常与更准确的标准输入"、标准输出"和标准错误"(stdin、stdout、stderr,来自 C)混淆.这些有时称为流,并且在大多数系统上默认定向到终端.在 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 的快捷方式和窗口标题带有命令提示符"标签,因为它可以访问命令提示符.我有一本名为Windows 命令行"的 Microsoft Press 书籍,上面写着命令行是...通过命令外壳窗口访问".因此,即使是微软也混合了他们的条款.

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 shell 都是具有 CLI 的 shell,可以从控制台运行,但不完全如此.

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.

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

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