To understand more about what’s going on with files and directories, it helps to understand the Unix model of files and directories even if your non-Unix system doesn’t work in this way. As usual, there’s more to the story than we’ll explain here, so check any good book on Unix internal details if you need the full story.
A mounted volume is a hard disk drive (or something else that works, more or less, like that, such as a disk partition, a floppy disk, a CD-ROM, or a DVD-ROM). It may contain any number of files and directories. Each file is stored in a numbered inode, which we can think of as a particular piece of disk real estate. One file might be stored in inode 613, and another in inode 7033.
To locate a particular file, we’ll have to look it up in a directory. A directory is a special kind of file, maintained by the system. Essentially, it is a table of filenames and their inode numbers. Along with the other things in the directory, there are two special directory entries. One is
. (called “dot”), which is the name of that directory; and the other is
.. (“dot-dot”), which is the directory one step higher in the hierarchy (i.e., the directory’s parent directory).
Figure 12-1 provides an illustration of two inodes. One is for a file called
chicken, and the other is Barney’s directory of poems,
/home/barney/poems, which contains that file. The file is stored in inode 613 and the directory is stored in inode 919. (The directory’s own name,
poems, doesn’t ...