Running Commands from the Shell
computer software
Running Commands from the Shell Running Commands from the Shell
Running Commands from the Shell   Home | Site Map | About Us | Products | Services | News | Contact Us | Links Running Commands from the Shell
Running Commands from the Shell Running Commands from the Shell

Copyright © 2009

Linux® Bible


Before you put a text processor, word processor, or similar program in the background,
make sure you save your file. It's easy to forget you have a program in the background,
and you will lose your data if you log out or the computer reboots later on.
To refer to a background job (to cancel it or bring it to the foreground), use a percent sign (
%
) fol-
lowed by the job number. You can also use the following to refer to a background job:
%
-- Refers to the most recent command put into the background (indicated by the plus
sign when you type the
jobs
command). This action brings the command to the fore-
ground.
%string
-- Refers to a job where the command begins with a particular
string
of char-
acters. The
string
must be unambiguous. (In other words, typing
%vi
when there are
two
vi
commands in the background results in an error message.)
%?string
-- Refers to a job where the command line contains a
string
at any point.
The string must be unambiguous or the match will fail.
%--
-- Refers to the previous job stopped before the one most recently stopped.
If a command is stopped, you can start it running again in the background using the
bg
command.
For example, take job 5 from the jobs list in the previous example:
[5]+ Stopped nroff -man man4/* >/tmp/man4
Type the following:
$ bg %5
After that, the job runs in the background. Its
jobs
entry appears as follows:
[5] Running nroff -man man4/* >/tmp/man4 &
Working with the Linux File System
The Linux file system is the structure in which all the information on your computer is stored.
Files are organized within a hierarchy of directories. Each directory can contain files, as well as
other directories.
If you were to map out the files and directories in Linux, it would look like an upside-down tree.
At the top is the root directory, which is represented by a single slash (
/
). Below that is a set of
common directories in the Linux system, such as
bin
,
dev
,
home
,
lib
, and
tmp
, to name a few.
Each of those directories, as well as directories added to the root, can contain subdirectories.
Figure 2-1 illustrates how the Linux file system is organized as a hierarchy. To demonstrate how
directories are connected, the figure shows a
/home
directory that contains subdirectories for three
users:
chris
,
mary
, and
tom
. Within the
chris
directory are subdirectories:
briefs
,
memos
, and
CAUTION
CAUTION
65
Running Commands from the Shell
2