P1: JDW
UNIX WL040/Bidgoli-Vol III-Ch-41 August 13, 2003 17:26 Char Count= 0
502 UNIXOPERATINGSYSTEMBourne Shell C ShellKorn Shell Bash Shell Z Shell TC ShellFigure 1: Shell lineage.determine what shell her or she is currently running by
issuing a command such asecho $SHELLThe above command will print out the user’s default
shell, something like “/bin/sh,” indicating the original
Bourne shell, or “/usr/local/bin/bash,” indicating the Bash
shell. An example of this command is given in Figure 2.
Although different shells support different features,
several significant features generally appear in one form
or another. Among these features are redirection, com-
mand history, command line editing, command line com-
pletion, and aliases.Entering Commands
Users can enter commands to run programs at the shell’s
command prompt. Every unix command has a commandname, which the user can use to run the program. For
example, the program to copy one file to another is called
“cp.” To execute the copy command, the user would entercp file1 file2which would copy the contents of file1 into another file
called file2 (creating that file if necessary).
The execution of commands can be tailored by the user
by issuing defined options (called “flags”) or supplying
arguments to the command. Options are preceded by
a single dash character ‘-’. For example, the standard
command to list out the files in a directory is the “ls”
command. By default, the “ls” command with no op-
tions will just list the names of the files in the directory.
By giving the ‘-l’ flag or option, however, more detail is
give about each file, including the files owner, group, ac-
cess permissions, file size, number of links, and so on.Figure 2: Discovering a default login shell.