Information Technology Reference
In-Depth Information
The new directory can be specified as a
full
or
absolute pathname
starting with
the root (
/
) directory or a
partial
or
relative pathname
starting at the current
working directory. The current directory can be referenced as a single dot (
.
)
and the directory above the current directory, referred to as the parent direc-
tory, can be referenced using two dots (
..
). For example:
$ pwd
/export/home/dla
$ cd ..
$ pwd
/export/home
$ cd .
$ pwd
/export/home
$ cd /export/home
$ pwd
/export/home
Multiple parents in the same path can be referenced using (
..
). For example:
$ pwd
/export/home/dla
$ cd ../..
$ pwd
/export
$
The metacharacters
?
and
*
can also be used to specify directory names.
Remember that
?
can represent any single character and
*
can represent any
number of any character. Assuming that the home directory
dla
is the only
directory under
/export/home
that matches all of the metacharacter expres-
sions, all of the following commands will result in changing the current
working directory to
/export/home/dla
:
cd /export/home/dla
cd /export/home/dl?
cd /export/home/d?a
cd /export/home/d??
cd /export/home/?la
cd /export/home/?l?
cd /export/home/??a
cd /export/home/???
cd /export/home/*
cd /export/home/d*
cd /export/home/*a
cd /export/home/*l*
cd /export/home/?l*
Be certain to understand the meaning and use of the
*
,
?
, and
[ ]
metacharacters
used to construct directory paths and filenames. Used separately or in combinations,
they can simplify specifying long complex pathnames or large sets of files.