Home » What is the exact difference between a ‘terminal’, a ‘shell’, a ‘tty’ and a ‘console’?

What is the exact difference between a ‘terminal’, a ‘shell’, a ‘tty’ and a ‘console’?


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.

Well, etymologically speaking, anyway.

In unix terminology, the short answer is that

  • terminal = tty = text input/output environment
  • console = physical terminal
  • shell = command line interpreter

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.

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.

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

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

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

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

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.

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.

  • Input: the terminal converts keys into control sequences (e.g. Lefte[D). The shell converts control sequences into commands (e.g. e[Dbackward-char).
  • Line editing, input history and completion are provided by the shell.
    • The terminal may provide its own line editing, 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.
  • 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.
  • The prompt is purely a shell concept.
  • The shell never sees the output of the commands it runs (unless redirected). Output history (scrollback) is purely a terminal concept.
  • 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).
  • 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.

A terminal or a console is a piece of hardware, using which a user can interact with a host. Basically a keyboard coupled with a text screen.
Nowadays nearly all terminals and consoles represent “virtual” ones.

The file that represents a terminal is, traditionally, called a tty file. If you look under the “/dev” directory of a UNIX system, you’ll find a lot of tty files connected to virtual consoles (e.g. tty1 on linux), virtual terminals (e.g. pts/0) or physically connected hardware (e.g. ttyS0 is the physical serial terminal, if any, attached on first serial port of the host).

A console must be a piece of hardware physically connected to (or part of) the host. It has a special role in the system: it is the main point to access a system for maintenance and some special operation can be done only from a console (e.g. see single user mode). A terminal can be, and usually is, a remote piece of hardware.

Last, but not the least, a shell is a special program that interacts with a user through a controlling tty and offers, to the user, the way of launching other programs (e.g. bash, csh, tcsh).

A terminal emulator is a program that emulates a physical terminal (e.g. xterm, gnome-terminal, minicom).

So when you look to a “text window” on your linux system (under X11) you are looking to: a terminal emulator, connected to a virtual terminal, identified by a tty file, inside which runs a shell.

SHORT explanation:

The console is a terminal. A system has got one console and potentially multiple terminals. The console is typically the primary interface for managing a computer, eg while it is still booting up.

A terminal is a session which can receive and send input and output for command-line programs. The console is a special case of these.

A TTY is essentially a pseudo device, call it a kernel resource, which is used by processes to access a specific terminal. TTYs can be tied to hardware such as a serial port, or can be virtual, eg created when a user logs in via a network

The shell is a program which is used for controlling and running programs. It is often used interactively, via a terminal. Several Shell programs exist, Bash being arguably the most commonly used shell today. Other shells, in no particular order, includes Bourne Shell, C-shell, Dash, Tsch, Ksh, and the increasingly popular zsh. There are many more.

When you have a GUI, you can use a terminal program to draw a nice resizeable border, add scroll bars, and format the text, and so on, for a terminal session. Often these are called terminal emulators, and sometimes they can handle multiple sessions via a TAB concept. A Terminal Emulator often starts a Shell to allow you to interactively work on a command line.

Related Solutions

Java and switch case

As said here, switch works with the byte, short, char, and int primitive data types. It also works with enumerated types and a few special classes that "wrap" certain primitive types: Character, Byte, Short, and Integer. The Java switch statement is compiled...

How to “force” users to upgrade their browser?

Updated Answer - March 2013 Since this answer was posted on November 2012, Google has discontinued this plugin. While it might still work as of today (March, 2014) there is no guarantee of it working in the future. As of January 2014, support for Chrome Frame...

Splitting credit card number fields into four different inputs

I would generally always opt for the simplest solution. In this case, one single field for the user to type into. With split fields, such as the 4-box one you propose it adds in an extra cognitive load to the user. "Do I need to manually jump to each field?"...

Is coffee a good excuse for a slow application start-up time?

To me, the basic logic is this: It's better to have a fast app than a slow app. While there are many studies that show that faster applications provide better UX, it seems pretty axiomatic to me. I mean, generally in life if we want something done, then we...

Why are terminal consoles still used?

From a UX perspective, terminal consoles have a few key advantages over GUI's. These advantages are rarely relevant to end-users, which is why CLI's are used almost exclusively by technical users and "power users" these days. Things done in a terminal are...

Should you always minimize cognitive load?

No. It is not always appropriate to minimize cognitive load. Minimizing cognitive load is not the goal of usability, human factors, UX, or the user centered design process in general. It is about "good design", and good design is not always the simple design....

How do you give your user options without overloading them?

While Charles's Answer shows some great UIs, I wanted to add the UX that Directory Opus uses for the same action, which I find very good as well. Simple on the surface with advanced options tucked away after a click. . Clicking on the Dropdowns results in these...

Why is it important to focus on user needs as opposed to requests?

Users are bad at asking for what they need and great at asking for what they want. Anecdotal evidence from my own recent experience: We have a department that asked for a button that would generate a PDF report about some data. A few months later they asked for...

Is Markdown Friendly Enough for Non-Technical Users?

I know I'm coming to this thread rather late, but I actually have run usability tests comparing a WYSIWYG editor (iWeb) to a non-WYSIWYG editor based mostly on markdown. Here's what I've found that users struggle with when using markdown: Tags that require...

Why do numpads on keyboards and phones have reversed layouts?

There's this humongous article called Keyboard Trivia that has collected many of the theories and stories. The summary of facts: Touch-tone key pad was designed to mimic the rotary dial with the "1" on top and the 7-8-9 on the bottom, and AT&T conducted...

Why are radio buttons circles?

Square was easy The earliest appearance of circular radio buttons that I can find is in Apple Macintosh System 4 (1987). Prior to that Mac OS used squares with beveled corners, which was probably just computationally easier to draw and better-looking on...

Why might right aligned field labels be better?

Luke Wroblewski wrote about this in Top, Right or Left Aligned Form Labels (April, 2007). In it, he references eyetracking data from an article by Matteo Penzo called Label Placement in Forms (July, 2006). Matteo drew several conclusions from this study,...

Which way should be “on” for a switch?

It appears to be dependent on country or region, as Wikpedia states in the article Light Switch: Up or down The direction which represents "on" also varies by country. In the USA and Canada and Mexico and the rest of North America, it is usual for the "on"...

Who needs an external on/off Wi-Fi button?

Security A hardware radio switch has security benefits to it in that when it is off, you know for a fact that nothing is connected to your laptop wirelessly. The radio switch usually turns off all wireless communication, including Bluetooth and 3G. I have heard...

How big a deal is blocking copy-pasting on a website?

Ask your client what he's actually trying to accomplish. Copy-paste restrictions are about as effective as a toddler gate preventing access to an unmonitored garden in a remote area. Perhaps you could ask the client where he saw copy-paste restrictions being...

What’s the point of a delayed popup on a webpage?

It is about increasing the chance of the user having a look at the popup. Task-completion mode Users in task-completion mode are eager to fulfil their goal (eg, "Is the product/information/answer I'm after on this page?"). As such, they simply ignore anything...