Chapter 6. The Linux Shells: An Overview

The shell is a program that acts as a buffer between you and the operating system. In its role as a command interpreter, it should (for the most part) act invisibly. It can also be used for simple programming.

Purpose of the Shell

There are three main uses for the shell: interactive use, customizing your Linux session, and programming.

Interactive Use

When the shell is used interactively, it waits for you to issue commands, processes them (to interpret special characters such as wildcards), and executes them. Shells also provide a set of commands, known as built-ins , to supplement Linux commands.

Customizing Your Linux Session

A Linux shell defines variables, such as the locations of your home directory and mail spool, to control the behavior of your session. Some variables are preset by the system; you can define others in startup files that your shell reads when you log in, or interactively for a single session. Startup files can also contain Linux or shell commands, for execution immediately after login.

Programming

A series of individual commands (be they shell commands or other Linux commands available on the system) combined into one executable file is called a shell script . Batch files in MS-DOS are a similar concept. bash is considered a powerful programming shell, while scripting in tcsh is rumored to be hazardous to your health.

Get Linux in a Nutshell, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.