Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terminal vs Console vs Shell vs Command Prompt? [closed]

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

like image 317
dsynkd Avatar asked Jan 09 '14 07:01

dsynkd


People also ask

What is the difference between terminal console shell and command line?

The console is a type of terminal. It is a window in which your text-mode programs are active. The shell is the program that actually processes commands and outputs results. A command-line interface is any type of interface that is used to enter (textual) commands.

Is shell and terminal the same?

A shell is a user interface for access to an operating system's services. Most often the user interacts with the shell using a command-line interface (CLI). The terminal is a program that opens a graphical window and lets you interact with the shell.

Is console same as CMD?

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). A command prompt is the invitation to type which is displayed by a Command Line Interpreter, or CLI.


1 Answers

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" 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.

EDIT: 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".

"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.

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).

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).

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.

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.

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.

like image 104
cdarke Avatar answered Sep 24 '22 05:09

cdarke