Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

I am fairly new to Ubuntu and I am loving it!

But I don't quite understand the difference between the shell and the terminal. Can any one explain? Someone told me that a terminal is just a "tool" to view the shell, akin to using a browser like Firefox or Chrome to "view" the web.

Is his analogy correct? Also what is the default shell of Ubuntu? Bash, tcshell, or something else?

share|improve this question

migrated from stackoverflow.com Nov 12 '10 at 3:24

This question came from our site for professional and enthusiast programmers.

marked as duplicate by fixer1234, mdpc, Kevin Panko, Excellll, karel Feb 23 at 18:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
You can usually find out what shell you're using with echo $0. –  Greg Hewgill Nov 12 '10 at 3:06

7 Answers 7

The shell is a program which accepts your commands (ls, cd, etc) and processes them by running built-in functions (like cd) or calling external programs (like ls or gcc).

The terminal is the thing (almost always a program these days, but often a piece of hardware back in the bronze age) that manages your keystrokes and shows text to you---both the bits you type and the bits the shell or another program returns to you. When the terminal is a GUI program it draws the nice graphical window, tells X what font to use, calls the text drawing routines and so on. In the old days it might have been little more than a fancy electric typewriter with fan-fold paper.

share|improve this answer

That's not a bad analogy at all. A terminal can be considered as just a device to display information and receive it. It can range from a dumb terminal which does nothing but interpret printable characters, to a behemoth with full cursor positioning and colour capabilities.

A shell, which often (but not always) runs in a terminal, is a powerful environment for interpreting commands and acting on them. You can consider most modern shells to be full-blown programming languages.

The basic idea behind an interactive shell is to accept those commands from the user (via the terminal) and act on them, either by doing its own stuff or running external programs to do it. A non-interactive shell is the one that generally runs pre-written scripts to perform tasks. Quite a few shell scripts will run without a terminal, since they have no need of user interaction.

Ubuntu's default shell is bash, although it's easy to change it to whatever you want.

share|improve this answer
    
is it really fair to call a shell a programming language? It is true that a shell will require very specific syntax for use, but I don't think that makes it a programming language. Could you elaborate? –  ubiquibacon Nov 12 '10 at 7:09
4  
@typoknig, sure, when you can do things like for i in {1..5}; do echo $i; done, it's a programming language, no real different from Perl/Python. Even cmd.exe is a programming language, albeit a fairly limited one compared to bash et al. If it weren't a programming language, what the heck have I been writing my scripts in for the last 25+ years? :-) –  paxdiablo Nov 12 '10 at 7:16

That is correct. The terminal emulator provides graphical handling for displaying a window, menu, etc. and text output, along with input via keyboard (and mouse, under certain conditions) to command-line programs.

The shell provides a flexible command line for input of commands to be executed, along with feedback on things such as the current directory, the superuser status, and so on.

The current default shell for Ubuntu is bash.

share|improve this answer

The default shell in Ubuntu is bash. Also, the shell is a program that you use to interact with the system (one of many ways to do this). By terminal, you mean a 'terminal emulator'. A terminal emulator could be considered a 'fake monitor', if you will.

share|improve this answer

The default shell in Ubuntu from 6.10 and up is Dash: https://wiki.ubuntu.com/DashAsBinSh

share|improve this answer
    
For programs invoking /bin/sh, yes. The default shell for users is still bash. –  Ignacio Vazquez-Abrams Nov 12 '10 at 3:05
    
Ah-- my bad. I spend my days in CentOS. –  Vic Nov 12 '10 at 3:05

Back in the old days, when computers were more expensive than a house, they were called mainframes. Computing was expensive, and still many people needed access. The solution? Terminals!

These were "dumb" computers, nothing more than a screen with a keyboard and a very basic computer. The terminal had a permanent connection to the mainframe. Commands were processed by the mainframe which returned results back to (the display of) the terminal. Most of what you did was text based, no graphics, no mouse, so all the terminal had to do was send and receive text, and display it on the screen.

If you take Chrome OS, or if you take a modern browser with a permanent internet connection and someone who does everything in the cloud, you get more or less the same idea. So your analogy of the browser is in fact very good.

Wikipedia says that a shell is a user interface to a computer, and it can be graphical as well. MS Windows is a shell. The UNIX or Linux shell is a CLI, commandline interface. Again, your browser analogy works here as well, with the webpage as the interface to the website and its database.

share|improve this answer

Shell is like explorer in windows(It's a specification).

Terminal is like Browser(It is conceptual).

bash, kash etc..are implementation of shell i.e., Chrome, Firebox, IE(It's implementation).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.