Basics
The UNIX file system is best represented as a heirarchical tree structure, with parent directories at the top, and their sub-directories below them. The following is an example of how the UNIX file system is laid out for the user account johndoe: |
![]() |
Pathnames: Absolute vs. Relative
When you begin moving around the UNIX system, you may find that it gets tiresome when you get farther down to keep typing a long pathname like:
This long name is called the absolute pathname. The absolute pathname is the full filename from the root directory. Any filename that begins with a '/' is an absolute filename. UNIX eliminates the abuse of the absolute pathname by providing keyboard shortcuts that allow for the use of relative pathnames. Relative pathnames are those pathnames referenced from the current directory. These relative pathnames can best be explained through examples of use of the shortcuts.
- ~ (tilde)
-
The tilde symbol allows users a very easy way to access any home directory. To use it, all the user does is type ~userid, where userid is the login name of the person whose home directory the user wishes to access.
Example:cd ~johndoe This would take the user to johndoe's home directory. NOTE: ~ by itself can be used to reference your own home directory.
- .. (parent directory)
-
The '..' symbol allows the user to reference the directory immediately above the one he/she is currently occupying.
Example:If the user is in the directory:
/users/j/johndoe/www Then, after the user types in: cd .. , they should be here:
/users/j/johndoe - . (current directory)
-
The '.' symbol allows the user to reference the directory they are currently in.
Example:If the user wanted to copy the file docs from the directory immediately above it into the current directory, they would simply type:
cp ../docs .
Symbolic Links
Another great thing about the UNIX file system is its use of links. NOTE: These links are different from the hyperlinks used in web documents. Links are another name for a pointer to a file. Every time a user creates a file or directory, they are creating a pointer in a directory.
The command ln -s is used to create a symbolic link to an existing file. A symbolic link is an indirect pointer to a file. A symbolic link can link to any file, regardless of its location in the file structure. For, example, take a look at the file system below, in which there are two accounts, johndoe and janedoe.

Suppose they are working together on a project, so janedoe creates the file 'project' in her www directory. She wants johndoe to help her on it, so he creates a link in his www directory to her project file in her www directory, like so:
This would create the link shown above by the dotted line. This link allows johndoe to access the file project as if it were in his www directory. NOTE: For johndoe to be able to link to janedoe's file, she must give him permission with the chmod command. For more information about links, check the man page.
![]() Previous Chapter |
![]() Table ofContents |
![]() Next Chapter |
---|