Solaris Advanced User's Guide

Directory Hierarchy

Files are grouped into directories, and directories are organized in a hierarchy. At the top of the hierarchy is the “root” directory, symbolized by “/”.

In the following example, Figure 3–1, each directory in the file system contains many subdirectories. The / character distinguishes directory levels. The directory / (root) contains the subdirectories /usr, /bin, /export/home and /lib, among others subdirectories. The subdirectory /export/home contains user1, user2, and user3.

When you initiate commands, you specify directories and files by including the names of the directories that contain the files or directories you want to work with. The names of directories and the files beneath them, combined with slash separators, constitute a path name. For example, the path name for the user3 directory in the following illustration is /export/home/user3.

Figure 3–1 File System Hierarchy

The preceding and following contexts describe the diagram.

All subdirectory names and file names within a directory must be unique. However, names within different directories can be the same. For example, the directory /usr contains the subdirectory /usr/lib. No conflict occurs between /usr/lib and /lib because the path names are different.

Path names for files work exactly like path names for directories. The path name of a file describes that file's place within the file-system hierarchy. For example, if the /export/home/user2 directory contains a file called report5, the path name for this file is /export/home/user2/report5. This example shows that the file report5 is within the directory user2, which is within the directory home, which is within the root (/) directory.