Red Hat ENTERPRISE LINUX 3 - STEP BY STEP GUIDE Manual page 41

Table of Contents

Advertisement

Chapter 3. Shell Prompt Basics
You can use absolute or relative pathnames. Absolute paths start at the top of the file system with
(referred to as root) and then look down for the requested directory; relative paths look down from
your current directory, wherever that may be. The following directory tree illustrates how
/
/directory1
/directory1/directory2
/directory1/directory2/directory3
If you are currently in
the directory tree.
Executing the command
cd directory1
while you are in
directory3
directory. This is because there is no
To move up to
directory1
cd /directory1
This is an example of an absolute path. It tells Linux to start at the top of the directory tree (
change to
directory1
Using absolute paths allows you to change to a directory from the
know and type the complete path. Using relative paths allows you to change to a directory relative
to the directory you are currently in, which can be convenient if you are changing to a subdirectory
within your current directory.
The command
cd ..
you are currently working. To go up two directories, use the
Use the following exercise to test what you have learned regarding absolute and relative paths. From
your home directory, type the relative path:
cd ../../etc/X11
After using the full command in the example, you should be in the directory
configuration files and directories related to the X Window System are available.
Take a look at your last
1. Go up one level to your login directory's parent directory (probably
2. Then go up to that directory's parent (which is the root, or
3. Then go down to the
4. Finally, go to the
Conversely, using an absolute path moves you to the
cd /etc/X11
Absolute paths start from the root directory (/) and move down to the directory you specify.
and you want to switch to
directory3
, presents you with an error message explaining that there is no such
directory1
, type:
. A path is absolute if the first character is a
tells your system to go up to the directory immediately above the one in which
command. You told your system to:
cd
directory
/etc/
directory
X11/
directory1
below
.
directory3
. Otherwise, it is a relative path.
/
directory, which requires you to
/
cd ../..
, directory)
/
directory more quickly. For example:
/etc/X11/
operates.
cd
, you need to move up in
command.
, which is where
X11
)
/home
27
/
) and
/

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents