December 20, 2014
 
 
RSSRSS feed

The Linux Command Shell For Beginners: What is the Shell?

So What's a "Shell", Anyway?

  • December 22, 2008
  • By Akkana Peck
In the last article I talked about simple command pipelines, one of the features that makes the Linux command line so powerful and so worth learning.

So if you want to get comfortable using the command line, here are some tips that will make it a lot easier.

When you read anything about the command line, you'll hear people use the term "shell", and sometimes terms like "terminal program" or "xterm" or "console". Do they all mean the same thing? Almost! The only difference is whether you are running a graphical environment or not.

If you tried the sample commands in the last article, you were probably running Gnome, KDE, or some other graphical desktop environment, and brought up some sort of window to type them in, maybe through some menu like Applications->System Tools->Terminal. Doesn't matter if you used gnome-terminal, konsole, xfce-terminal or xterm; they're just different types of "terminal windows" or "terminal programs". These are all X terminals, because they run in the X Window System, which is the foundation of all graphical desktops and window managers.

The Linux console is what you see when you do not run a graphical desktop. If you are already in a graphical environment you can see it by pressing CTRL+ALT+F2. (Don't do this just yet!) This takes you to a bare naked login prompt with no GUI. ALT+F1 through ALT+F6 are all consoles. To get back to your graphical desktop, press ALT+F7. (OK, now you can try it.) Most Linux distributions have a "console login" option available in their graphical login managers. Unlike switching back and forth with CTRL+ALT+Fn/ALT+F7, X does not start at all when you use this. But you can start X yourself after logging in to the console with the startx command, so you don't need to log out or reboot.

Any X terminal is nice because you can have multiple tabs or terminals open, and it's easier to configure pretty fonts and colors.

So what's a "shell", anyway?

Okay, so you have a terminal or console running. But in order to use the command line, you need a shell. It is also called a command shell. The shell is the program that reads the command you type, tries to make sense of it, then figures out what to do with it -- which programs to run and where to find them.

Linux has lots of different shells available. Their names almost always end in sh (for shell). The most common shell, and the one you're probably running, is called bash (for "Bourne Again SHell", because it was designed as an extended and Free version of a classic shell written by Stephen Bourne of AT&T's Bell Laboratories). But if you're using a different shell, that's fine; all the basic commands and mechanisms work the same in all shells. You can easily find out what your active shell is with this command:

$ echo $SHELL
/bin/bash

If you need a refresher course in the basics of typing commands, please refer to our last article.

Sitemap | Contact Us