What is the difference between shell, console, and terminal?

131,906

Solution 1

In the linux world they can all look the same from the point of view of the user at the keyboard. The differences are in how they interact with each other.

The shell is the program which actually processes commands and returns output. Most shells also manage foreground and background processes, command history and command line editing. These features (and many more) are standard in bash, the most common shell in modern linux systems.

A terminal refers to a wrapper program which runs a shell. Decades ago, this was a physical device consisting of little more than a monitor and keyboard. As unix/linux systems added better multiprocessing and windowing systems, this terminal concept was abstracted into software. Now you have programs such as Gnome Terminal which launches a window in a Gnome windowing environment which will run a shell into which you can enter commands.

The console is a special sort of terminal. Historically, the console was a single keyboard and monitor plugged into a dedicated serial console port on a computer used for direct communication at a low level with the operating system. Modern linux systems provide virtual consoles. These are accessed through key combinations (e.g. Alt+F1 or Ctrl+Alt+F1; the function key numbers different consoles) which are handled at low levels of the linux operating system -- this means that there is no special service which needs to be installed and configured to run. Interacting with the console is also done using a shell program.

Solution 2

A shell is a program that puts up a prompt and waits for you to type commands. It executes them and then prints another prompt. So, like CMD in Windows, or Bash in Unix. It can run in a terminal or on the console.

A console was originally a physical thing, a control panel. In computing terms it usually means the display that you see before the GUI starts up or after it finishes; you can sometimes switch to displaying it instead of the GUI. It's the place where the operating system prints error messages. On a multi-user computer, it's the display that's actually attached to the computer. Just to confuse you, on Windows it can also mean a window with a command shell in it, i.e. a terminal.

A terminal was also originally hardware, used to communicate with a computer. Nowadays it usually refers to a window with a command line (shell), which might appear in a GUI window or instead of a GUI.

Solution 3

For beginner beginners

For a more detailed description: https://askubuntu.com/a/506628/130518

  • terminal = text input/output environment
  • console = physical terminal (something you can actually physically touch)
  • shell = command line interpreter

I will be describing the most normal use case for this in the following text.

A terminal uses a shell. A shell can run without a terminal.

To relate to everyday items:

  • Terminal -> TV screen in your home
  • Shell -> Program that is running on the TV screen

Another way of looking at it: Your ears (input) and mouth (output) are the terminals for sound. Your brain is the interpreter of those sounds using a specific shell (processing).

The terminal is for us humans, so we can read and write to/from the shell. Shells can run in background processes that do not require human interaction e.g. cron job, and therefore do not require a terminal.

Few examples of terminals that exist:

  • Command prompt
  • guake
  • gnome-terminal
  • terminator

Few examples of shells that exist:

  • Bash
  • sh (Bourne shell)
  • PowerShell [windows]
  • zsh (Z shell)

I've only written how these two normally work, there are other ways they work, but that is for a more advanced user.

Solution 4

A Terminal is a text-based interface (possibly to a shell)

The difference between console and shell is one I don't yet grasp, but I can tell you how a terminal is different from a shell.

The terminal is (according to Wikipedia) "a serial computer interface for text entry and display. Information is presented as an array of pre-selected formed characters".

You can use a terminal to interact with a shell, but you can also use it to interact with a text-based GUI, sometimes called a Terminal User Interface. For example:

  • Vim has GUI elements including line numbers and named tabs
  • Nano has GUI elements including a help menu of commands
  • Tmux has GUI elements including a status bar and dividing lines between panes
  • Minicom has GUI elements including menus and a status bar

In each case, the GUI elements are "drawn" with text rather than pixels.

Solution 5

Think to another context, that is development.
Even if you don't have a very deep knowledge of development, you probably know the basics, that is: you edit a program, you submit it to a compiler or to an interpreter that builds a compiled application.
The console is like the editor of your program; it helps you in writing but it doesn't really execute anything: when you have finished you send it to the compiler for that.

You can use your preferred editor, vim, gedit, emacs, notepad++, Netbeans, eclise etc.etc but at the end they are just different tools: if you write the same program the output will be the same.
In this metaphor, the shell is the compiler. The commands that are entered into the terminal, are sent to the shell that interprets them and executes them immediately.
So, while terminals are just front-ends for the shell, the shell contains the actual language, as happens for the compiler.

Obviously a terminal is not exactly a text editor, mainly because it doesn't produce a file but sends text to the underlying shell and retrieves output from it.

And the shell is not a compiler, in fact it interprets your command and executes it immediately instead of building an executable.

Even whit this big difference, i find this metaphor to help a lot in understanding this idea.

Share:
131,906

Related videos on Youtube

Robin
Author by

Robin

Updated on September 17, 2022

Comments

  • Robin
    Robin over 1 year

    I'm confused with the terminology. What is the difference between shell, console, and terminal?

    • n611x007
      n611x007 about 11 years
      and what about prompt and even command line?
    • Flimm
      Flimm about 10 years
      Have a look at this question from Unix & Linux: unix.stackexchange.com/questions/4126/…
    • Kenji Noguchi
      Kenji Noguchi over 7 years
      My wife said "the black screen"
    • Ben Butterworth
      Ben Butterworth about 4 years
      iTerm2, terminal, Hyper are terminals. Zsh (z-shell), bash (Bourne again shell) are shells. It all makes sense now, its in their names! Personally Im not going to bother with console.
  • DrColossos
    DrColossos about 14 years
    Before terminals were monitors with keyboards, they were teletypes -- a sort of electric typewriter. en.wikipedia.org/wiki/Teleprinter
  • Doug Harris
    Doug Harris about 14 years
    Ah, yes, that was my first interaction with a computer. Thanks for reminding me.
  • user1686
    user1686 about 14 years
    Windows also has "shells" (cmd.exe and PowerShell being the most common ones) and terminals (the "Windows Console").
  • DrColossos
    DrColossos about 14 years
    Console sometimes means "the keyboard and monitor physically attached to this computer." E.g., "I logged on from the console because the server was not responding to the network."
  • Robin
    Robin about 14 years
    @Doug Harris: Can you add some pictures of the hardware you are talking about?
  • Doug Harris
    Doug Harris almost 14 years
    When I was in college in the late 1980s, I did a lot of work on DEC VT220 terminals -- en.wikipedia.org/wiki/VT220 -- That's a good example of the physical device I described.
  • likethesky
    likethesky over 10 years
    I found the Unix & Linux StackExchange answer to this question also provided a bit more detail and was worth reading as well.
  • Gavin Hope
    Gavin Hope over 8 years
    So, if terminals and consoles are, in the modern day, each implemented in software - what is the difference between the two (now)?
  • Jorge Orpinel Pérez
    Jorge Orpinel Pérez over 8 years
    @GavinHope I think the console is "low-level", implemented as part of the OS core. Graphic shells like Gnome run on top of that, then terminals like gnome-terminal run further on top of that. So the difference would be the level at which they run.
  • jiggunjer
    jiggunjer almost 8 years
    I would rephrase what @Jorge Orpinel said as virtual consoles being a type of terminal, i.e. the form. You could also have a terminal like cortana/siri, but that would not be a console.
  • jiggunjer
    jiggunjer almost 8 years
    I'm not sure about this definition of it being only text based. In a way some GUIs could be considered terminals imo.
  • ARNAB
    ARNAB over 3 years
    So bash isn't a shell if bash_profile runs startx?
  • ARNAB
    ARNAB over 3 years
    It strikes me that an instance of the bash interpreter running a script is still a shell.
  • Peter Westlake
    Peter Westlake over 3 years
    @RichieHH, I would say that the bash process is still a shell, but if it's only being used to run startx, it's a shell that isn't doing very much.