2.
Shell reserved word -- Words reserved by the shell for special use. Many of these are
words that you would use in programming-type functions, such as
do
,
while
,
case
, and
else
.
3.
Function -- A set of commands that are executed together within the current shell.
4.
Built-in command -- A command built into the shell. As a result, there is no representa-
tion of the command in the file system. Some of the most common commands you will
use are shell built-in commands, such as
cd
(to change directories),
echo
(to echo text to
the screen),
exit
(to exit from a shell),
fg
(to bring a command running in the back-
ground to the foreground),
history
(to see a list of commands that were previously
run),
pwd
(to list the present working directory),
set
(to set shell options), and
type
(to
show the location of a command).
5.
File system command -- A command that is stored in and executed from the com-
puter's file system. (These are the commands that are indicated by the value of the
PATH variable.)
To find out where a particular command is taken from, you can use the
type
command. (If you
are using a shell other than
bash
, use the
which
command instead.) For example, to find out
where the bash shell command is located, type the following:
$ type bash
bash is /bin/bash
Try these few words with the
type
command to see other locations of commands:
which
,
case
,
and
return
. If a command resides in several locations, you can add the
-a
option to have all the
known locations of the command printed.
Sometimes you run a command and receive an error message that the command was
not found or that permission to run the command was denied. In the first case, check
that you spelled the command correctly and that it is located in your PATH variable. In the second
case, the command may be in the PATH variable, but may not be executable. Adding execute permis-
sions to a command is described later in this chapter.
Rerunning Commands
After typing a long or complex command line, it's annoying to learn that you mistyped something.
Fortunately, some shell features let you recall previous command lines, edit those lines, or com-
plete a partially typed command line.
The shell history is a list of the commands that you have entered before. Using the
history
com-
mand in a bash shell, you can view your previous commands. Then, using various shell features,
you can recall individual command lines from that list and change them however you please.
The rest of this section describes how to do command-line editing, how to complete parts of com-
mand lines, and how to recall and work with the history list.
TIP
TIP
48
Linux First Steps
Part I