DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Directories and files

Directories

Information held in a UNIX system is organized in files. Files, in turn, are organized into directories. The directories themselves are organized into a tree structure: that is, there is one common root from which there are branches, from which there are more branches, and so on.

To go to a place on the computer, you need to know its pathname. The pathname tells the computer which directory you want to go to or look at.

An absolute pathname begins with the root directory and specifies every directory on the way to the directory or file you want to work with. A relative pathname tells the computer to go to a particular directory relative to the directory where you are right now. Directories are separated by slashes (/) in pathnames. The last word of a pathname is either a directory name or a filename.

This is the pathname for the message of the day, the message that is displayed when you log in to the computer:

/etc/motd

This says ``go to the root directory, (/), then go into etc, then go to motd.'' (DOS users will notice that pathnames on the UNIX system are like pathnames on DOS, only the slashes point the other way.)

cd /etc

To say ``one directory up from here,'' use the shorthand ``..'' (dot dot). The shorthand for the directory you are in is ``.'' (dot), although you rarely find reason to type this.

Here is the pathname for /etc/motd, but shown as a pathname relative to /u/susannah:

../../etc/motd

This says ``go up two directory levels (which takes you to the root directory), then go into etc, then go to motd.''

cd ../../etc


If we wanted to go into Tutorial, a directory below /u/susannah, the relative pathname would be Tutorial.

Pathnames without a leading ``/'' are relative pathnames.


Next topic: Your home directory
Previous topic: Directories and files

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005