DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Working with files and directories

How directories are organized

Directories are organized as an inverted tree structure. Only one directory, at the top of the tree, is not contained in any other directory. This is called the root directory, and its name is represented by a slash (/) character. To help clarify this, look at the following picture of part of a directory tree:

In this picture, directories are depicted by ovals, and ordinary files by rectangles. Notice that most of the directories have lines coming out of them, indicating that they lead to files or other directories.

When you work within a UNIX filesystem, you always have a current working directory. All filenames and commands that you type at the prompt are evaluated with respect to this position. When you log in, your current working directory is set to the directory created for your user account. This location is known as your home directory.

Any file or directory on the system can be specified uniquely by its pathname. Pathnames are instructions for finding a file or directory; they list, in order, each directory you must pass through to get to the file or directory in question. When the pathname is written down, the directories are separated by slashes (/). For example, the full pathname of the file called review in the diagram above is /usr/susanna/review. The first slash character denotes the root directory: all the others are separators.

A pathname that begins at the root directory is called an absolute or full pathname. There are also relative pathnames, which give directions to a file relative to your current working directory. Two dots in a row (..) represent the parent of the current directory.

For example, if you were working in the directory called /usr/sarah and you needed to specify the file in /usr/susanna called mbox, you could use the relative pathname ../susanna/mbox, or the absolute pathname /usr/susanna/mbox. (Remember, ``..'' refers to the parent directory of the current working directory; so in this case it refers to /usr, which is the parent of both susanna and sarah.)


Next topic: An example: what the system contains
Previous topic: Managing directories

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003