Links and Files
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 exactly this way. As usual, there’s more to the story than we’re able to 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, while another is in inode 7033.
To locate a particular file, though, 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
always two special directory entries. One is .
(called
“dot”), which is the name of that very directory; the other is ..
(“dot-dot”), which is the directory one
step higher in the hierarchy (i.e., the directory’s parent directory).[†] Figure 13-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, while the directory is stored in inode 919. (The ...
Get Learning Perl, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.