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.

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
1  
You can usually find out what shell you're using with echo $0. –  Greg Hewgill Nov 12 '10 at 3:06
add comment

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

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

5 Answers

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 dies 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
3  
@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
add comment

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
add comment

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
add comment

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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