To gain a full picture of the internal operation of filesystems, it is necessary to understand what the user sees, why things are presented the way they are, and what the main concepts are. This module provides an introduction to basic file concepts.
Users new to UNIX and those starting to program in the UNIX environment will find these concepts useful. A basic implementation of the
ls program
helps to reinforce the material presented and provides an introduction to file-related libraries and system calls, a topic that will be expanded upon in the next module. One peculiarity that UNIX introduced was the notion that everything in the UNIX namespace (file tree) is visible as a file and that the same operations can be applied to all file types. Thus one can open and read a directory in the same way in which a file can be opened and read.
Of course, this does not always have the desired effect. For example, running the UNIX command cat on a directory will likely produce a screen full of unreadable characters. However, these and other
simple concepts are one of the great strengths of UNIX. The following sections provide introductory material which describe file-based concepts and start to paint a picture of how these components fit together.
In the next lesson, advanced ways to list files using the
ls
command will be discussed.