next up previous contents
Next: Creating Directories Up: Basic Directory Commands Previous: Listing Directory Contents

Changing Directories

The chdir command is used for changing from one directory to another. The command has a shorter form cd which is used more often. There are two ways to specify the directory you wish to change to:

1.
Absolute Pathnames
An absolute path is one that is specified completely from the root directory:
cd /sulu/usr

The `/' character before the sulu directory name indicates that the path is absolute. The '/' refers to the system root directory, ie: the top level directory.

An absolute path that doesn't really look like it's absolute is any path that begins with '~/'. The'~' character is the complete path from the root directory to your home directory. This form is very useful when you wish to ascend from deep within your directory tree, but you don't want to type an absolute path from the root. It is also useful when you are elsewhere in the system and you wish to read or write files to one of your subdirectories.

2.
Relative Pathnames
Relative pathnames assume the current directory as the base from which paths to other directories are specified:

cd pascal/lib

The lack of a preceding `/' character before the pascal directory name means that the path is relative to (below) the current directory. To move up in a directory tree, use ''..''. Every UNIX directory has a file named ''..'' in it, which refers to the parent directory. Thus to move to the directory right above your current directory, issue:

cd ..

To move up two directory levels issue:

cd ../../

Using ''..'' you can ascend to the parent directory, then descend into another child directory with one statement. If your current directory were /sulu/c++/lib, then issuing:

cd ../bin

would make your current directory /sulu/c++/bin


next up previous contents
Next: Creating Directories Up: Basic Directory Commands Previous: Listing Directory Contents
World Wide Web Administrator
1/5/1999