What is the difference between Terminal, Console, Shell, and Command Line?
The short answer is that
Console and terminal 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.
In unix terminology, a terminal is a particular kind of device file which implements a number of additional commands (ioctls) beyond read and write. Some terminals 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 terminals, sometimes called pseudo-terminals or pseudo-ttys, are provided (through a thin kernel layer) by programs called terminal emulators. Some types of terminal emulators include:
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.
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) terminals. On some systems, such as Linux and FreeBSD, the console appears as several terminals (ttys) (special key combinations switch between these terminals); just to confuse matters, the name given to each particular terminal can be “console”, ”virtual console”, ”virtual terminal”, and other variations.
A command line is an interface where the user types a command (which is expressed as a sequence of characters — typically a command name followed by some parameters) and presses the Return key to execute that command.
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.)
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 (with the notable recent exception of Gnome Shell) usually don't use the word “shell”; for example, window systems involve “window managers” and “desktop environments”, not a “shell”.
There are many different unix shells. Ubuntu's default shell is Bash (like most other Linux distributions). Popular alternatives include 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 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
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).
The division of labor between the terminal and the shell is not completely obvious. Here are their main tasks.
Recycled from Unix & Linux
A visual representation.
Something you can sit down at, and work like a boss.
Some hardware that does a bunch of stuff.
Another example of a console, would be a video game console such as a Super Nintendo [where you can play Actraiser]
Basically an application for running commands.
Command Line [Interface]
Basically anything you input commands into.
From the Linux Information Project:
In Our words A GUI Application , from where we can access an user's console.
These terms often go together, so people use one of the terms to refer to the collection. (i.e. it's usually obvious from context that they mean a terminal window providing an interface to a command line shell).
To keep this from getting to long-winded, I'm just going to say xterm as a stand-in for XTerm / Gnome Terminal / Konsole / mrxvt / etc / etc. Same for bash.
Console has multiple other specific meanings, so leave that out for now.
Terminal: Something that provides human interaction with programs through a bidirectional stream of ASCII / UTF8 / other characters, usually with VT100 or similar escape code processing. (E.g. backspace, delete, arrow keys, etc. generate escape codes. Programs can print escape codes to move the cursor around the terminal screen, switch to bold text, and/or color, clear or scroll the screen, etc.) In the old days, this was often a dedicated appliance with a screen and keyboard and a serial port. Now, it's usually a program like xterm.
There are device files for programs to read/write from/to terminals, and virtual terminals also have the other side accessible as a device file. This is where xterm writes your input so bash can read it.
Every terminal, including virtual ones, provides basic line editing when it's in cooked (as opposed to raw) mode. This is handled by kernel code. It's bash that provides the line editing that you can do with the arrow keys. (Try running
Even though there is a lot of kernel code behind the terminal devices, it would be refered to as terminal-handling code, not as a terminal itself.
Edit: Gilles has convinced me that referring to a tty as a terminal is proper usage. Terminal Emulators, and interactive programs that run connected to a terminal, are all dependent on the terminal semantics implemented by the kernel. (Most of this behaviour is standardised by POSIX, and is the same across Linux/*BSD/other Unix.) A full-screen text editor depends on the behaviour of Unix tty stuff as well as the cursor-movement escape-code handling, and many other features, of the terminal emulator.
However, a physical VT100 with a screen, keyboard, and serial port is an instance of a terminal. It doesn't require a Unix kernel on the other end of its serial port to be complete. Something completely different could be sending it escape codes and ASCII text, and receiving the same from it. It would just be a VT100, though, not a Unix terminal. A terminal emulator plus the Unix tty semantics make up the full package of a Unix terminal that a program like bash normally runs on.
Command line is a style of user interface, where you type something, then press return to make something happen. It's also used as a shorthand for a command-line shell, like bash or MS-DOS, but you can also say “it's a command line tool” about something like fdisk. Considering only programs that use a terminal for their UI, the two main families are command line and full-screen text (e.g. an editor like vi or
Command line programs that normally run on terminals almost always still work with their input and output redirected to files, but terminal-based full-screen programs like editors or email clients are interactive-only, and wouldn't work.
A shell is a program for starting other programs. In a Unix context, it's common to mean command-line shell (i.e. Bourne shell or C shell equivalent). Unix shells can also read their input from files, i.e. shell scripts. They are full programming languages, with variables, loops, and conditionals, and many programs are written in bash (or with only the
Putting it all together, a shell like bash (or whatever program you started by running a shell command) will receive characters from the
Console is sometimes used as a synonym for terminal (KDE even has a terminal emulator called Konsole).
As 0xSheepdog points out, it also has another meaning: locally attached human-interaction hardware.
In a kernel context, console has another specific meaning: it's the terminal where boot messages are written. This can be a serial port. Normally, of course, it's the text console implemented by the kernel on top of the drivers for graphics hardware and USB/ps2/AT keyboards. If you boot Linux with
Linux implements virtual consoles (
The standard 6 virtual terminals with login prompts is why Ctrl+Alt+F7 gets you back to your X11 session: the X server grabs the next available virtual console. (The X server opens
So "swap to a text console" means to press Ctrl+Alt+F1 and use that terminal. Back when computers were slow and didn't have much RAM, some people spent much of their time on the text consoles, since they were fast, you could set a nice font, and even change the terminal size to have smaller characters, but have more on screen at once. Alt+Left and Alt+Right swap to prev/next console. (X11 disables this for its console, of course, leaving only the Ctrl+Alt+FN combo.)
So console is the only one of these terms that doesn't have a single well-defined technical meaning. It has a couple different ones. (Depending on how you feel about terminal proper vs. terminal plus tty handling, you could say that terminal also has multiple meanings.)
The answers here seem very good. However they are too dry and technical for my taste so I'll give a take..
A computer's purpose is to get data, do something with it, and spit out the result. Thus the terminal is any device from where you can get the result of the computation.. a screen for example. It just so happened that in the first computers you usually had the input (keyboard) and output (screen) as a single device. Because of that nowadays terminals are considered any input/output devices. A mouse, keyboard, screen, camera, they are all terminals.
That's why in music industry the board with all the knobs, or in a space shuttle the command table, they are all considered consoles. Super Nintendo and PS2 are also called consoles historically since the first such entertainment devices looked like boxes with a bunch of buttons on them.
I think that back in the early days of time-sharing computers, every user had a terminal (when they could get one!), but only the system operators had a console. The console could be used for tasks like rebooting the machine or getting system diagnostics that weren't possible from user terminals. The console was in the machine room, an intrinsic part of the computer, whereas the terminals could be remote. The console would also include hardware lights and switches, not just text input and output.
I would say that the command line is an area where a user can type a command, whereas the shell is the program that interprets/obeys that command. The term "shell" is very particular to Unix derivatives; "command-line" is more in the Windows/DOS tradition. The equivalent on mainframes is usually called a "job control language".
Clearly, these original distinctions have become blurred over time as technology changes.
To Summarize my answer :
Shell is a program which
Terminal is a program that
So I open Gnome-Terminal , a black windows appear that run Shell so i can run my commands.
Console is a special sort of terminal , it was also a Physical device . example in Linux we have
Console sometimes means the keyboard and monitor physically attached to this computer.
Most terminals nowadays are strictly speaking terminal emulators.
It is a type of role in the workings of a UNIX-like system and at the same time the basic interface offered by the systems. In fact everything, including the GUI builds on top of it.
Console refers to the (hardware) interfaces for the terminals. I.e. there are serial consoles and nowadays mostly virtual ones.
Back in the day when computers were expensive a facility might have had one actual computer and several terminals connecting to it, via serial cables ("serial console"). The OS, operations, etc. were carried out on the physical Computer, input and output happened on the console(s).
shell is the "engine" that you see in the terminal. It provides interop with the system itself and adds nice features like auto-complete, variables etc..
command line refers to the method of method of exchanging input and output via a text-window. Strictly speaking the line in which you type is the (current) command line. The method in general is more correctly referred to as command line interaface or CLI.
Trying user-centric short answer:
command line - the line where you enter commands. Usually it used to tell that you need to run something in text mode window (command line interface) provided by your operating system.
shell - the actual program run by operating system to process stuff you enter into
console - is a window where your text mode programs are running. This window processes key presses, knows it is width and height. Can be fullscreen.
terminal - is some device with display for humans that accepts input stream of characters and shows them. There is no feedback to user about height or width (only hacks) or keyboard keypresses - only chars are travelling to it. Terminal processes special sequences in this stream to make things colored, clean up the screen and do other nasty things. Terminals are flaky, because it is easy to mess things if the file you are piping to output contains that special sequences. They are popular in networking and device debug interfaces, because you just need a single stream for sending output and control the output device and you can just
serial console - is a console that processes input stream like a terminal.