SECTION 6

DIRECTORIES

A directory is a catalogue of the segments ''beneath" it. It contains information about all the attributes of each segment. Every segment and directory in the system (except the root directory, the originating directory of the Multics system) is immediately under another directory. Imagine it this way:

tmpCF-1.gif

Without realizing it, you have been working "under" your own directory. This directory is called your home directory. It is usually named after you; its name is the same as your Person id. You are always placed in your home directory when you log in, so when you log in, your home directory is your working directory. (You learn how to make another directory your working directory in "Changing Directories" below.) The list command can be thought of as a command that prints the contents of your home directory: the list of segments under your Person_id, and the attributes of each segment. Here is a diagram of Pam Sissle's home directory:

tmpCF-2.gif

Each user in your project has a home directory similar to yours. The home directories of users are often called user directories. All of the user directories of the people in your project are grouped under another directory: the project directory. Your project directory has the same name as your Project_id. For example:

tmpCF-3.gif

Your project is one of many projects that use your Multics system. All of the project directories are gathered under a directory called the user_directory_directory, or "udd".

The segments and directories just described are part of the Multics storage system. Its organization is analogous to the structure of an inverted tree:

tmpCF-4.gif

The udd directory, and several additional directories governing other parts of the Multics system (not shown above), are directly beneath the root directory, which stands alone at the top of the directory hierarchy.

PATHNAMES

Absolute Pathnames

Every segment in the Multics storage system is identified by its absolute pathname. The absolute pathname of a segment is actually a series of names, separated by the ">" (greater-than) character, representing the position of that segment in this directory hierarchy. For example, the pathname:

tmpCF-5.gif

stands for the segment named "frog", located under the user directory named "PSissle". The "PSissle" directory is stored under the project directory "Doc", which in turn is stored under the directory "udd", which is stored under the root directory (">").

When you type the absolute pathname of a segment, it always ends with the segment name. The other names in the absolute pathname are all names of directories.

Notice that the root directory is not explicitly named in the absolute pathname. Because it is present in the path of every segment, its presence is always implied by the initial ">" character of the pathname.

Relative Pathnames

The pathnames you have been using in earlier sections of this manual are called relative pathnames. Relative pathnames (which never begin with the ">" character) are shortened versions of absolute pathnames. The relative pathname of a segment begins after - is RELATIVE to - the name of your working directory. When you type a relative pathname, the system automatically adds on the absolute pathname of your working directory. Thus when Pam Sissle is in her home directory and types:

tmpCF-6.gif

She sees the same segment that she would see if she typed:

tmpCF-7.gif

For convenience, use relative pathnames whenever you can: for all segments under your working directory.

SHARING SEGMENTS

There are many times when absolute pathnames are useful, and even essential. To print someone else's segment, you type the absolute pathname, since you do not have that segment in your own directory. Pam Sissle, from her home directory, prints Jakob Kissle's segment "neonate" with this command line:

tmpCF-8.gif

To place a copy of this segment in her own directory, so that she may modify it for her own use, Pam uses the copy command (cp) :

tmpCF-9.gif

The syntax line for the copy command is:

tmpCF-10.gif

The first pathname is the name of the segment that is to be copied. The segment "neonate" is in Jakob's directory, so Pam specifies its absolute pathname. She wants the copy of Jakob's segment to be placed in her home directory. Because she is already in her home directory, the system automatically places the rest of the absolute pathname in front of the relative pathname.

Access to Segments

Many of the commands you have learned about in previous sections can "be used with absolute pathnames, for example the dprint command and the segment naming commands (see Section 5). However, you may not have the correct access to the segments when you try to use these commands. If you do not, you will receive an error message like this one:

tmpCF-11.gif

If this happens to you, try sending a message to the person whose segment you want, asking for the correct access. Also, read Section 7, "Access", for more information about access.

CREATING DIRECTORIES

It is possible to remain in your home directory and do all your work on Multics from there. It is also possible for you to create a directory underneath your home directory. You can even create your own directory hierarchy, if you like. You can then place both new and existing segments into these directories. This can be very useful as a means of organizing your segments into categories.

To create a directory, use the create_dir command (cd) with the name of the new directory:

tmpCF-12.gif

You may use the create_dir command (cd) to continue building a directory hierarchy under your home directory up to 15 directories from the root.

To place existing segments under the "mammals" directory, you may use either the copy command (cp) or the move command. The copy command is used primarily for making copies of other people's segments, as shown above.

The move command (mv) is most useful for moving your own segments from your home directory to a more appropriate directory. While the copy command leaves the original segment where it is and makes a copy in the new location, the move command moves the original segment away from the first location and into the new location. The syntax line is:

tmpCF-13.gif

For example, Pam uses the move command from her home directory:

tmpCF-14.gif

In this example, Pam Sissle moves her "Doggerel" segment from her home directory down to her "mammals" directory, using relative pathnames (relative to her home directory) for both arguments.

To place new segments under her "mammals" directory, Pam can use an editor to specify the location she wants at the same time she creates the segment.

tmpCF-15.gif

Instead of writing her text with just a segment name, she gives it a longer relative pathname that places the segment named "Cattery" in the "mammals" directory, which is assumed by Multics to be underneath her home directory. Here is a diagram of Pam's current directory hierarchy:

tmpCF-16.gif

The segment naming commands introduced in Section 5 can be used to add, change, and delete directory names also.

CHANGING DIRECTORIES

You may want to change to another directory and use it as your working directory. Your home directory has been your working directory so far. To change your working directory, use the change_wdir command with the pathname ox the directory you wish to work with:

tmpCF-17.gif

When you are working in another directory, relative pathnames are relative to THAT directory. For example, when Pam is in her home directory and she wants to print the "Cattery" segment (which is located in her "mammals" directory), she types:

tmpCF-18.gif

When she moves to the "mammals" directory, she types:

tmpCF-19.gif

To check on what your current working directory is, use the print_wdir command (pwd):

tmpCF-20.gif

The print_wdir command always prints the absolute pathname of your working directory.

To return to your home directory, use the change_wdir command without any pathnames after it. In the example below, Pam has followed the change_wdir command with the print_wdir command, to reassure herself of her position:

tmpCF-21.gif

The default argument of the change_wdir command is always the pathname of your home directory.

DELETING DIRECTORIES

Finally, you may delete directories as well as segments, with the delete_dir command (dd). Because the accidental deletion of a directory could cause so much pain, the system asks if you really want to take this step:

tmpCF-22.gif

When you delete a directory, you delete ALL the directories and segments under it, so be cautious with this command.

 

<< Previous Section                                          Next Section >>

Contents | 1 | 2 | 3 | 4 | 5 | 6 | 7 | A | B