Concepts
To understand the concept of a directory, consider an analogy of an office block containing a number of offices. Each office has a name. Inside each office there are a number of filing cabinets, each of which is named. Files are stored in the filing cabinets. Each file also has a name.
Suppose a file called Lombard is located in the Staff cabinet of the Administration office. This could be described in a shorthand form as /Administration/Staff/Lombard. In the same way /Stores/Suppliers/Kumar would indicate a file called Kumar in the Suppliers filing cabinet in the Stores office.
Directories on a computer system are similar to the offices and filing cabinets. A directory is a container that can contain files or other directories. A directory located inside another directory is called a sub-directory. Sometimes the word folder is used in place of the word directory. One difference between the analogy and a computer system is that in the former case we are dealing physical objects whereas in the latter we are dealing with a more abstract structure.
Directories, sub-directories and files are arranged in a hierarchical structure called a tree. A typical computer will contain many thousands of files stored in many directories. Each directory contains files that are related in some way. The starting point of the tree is called the root. Do not confuse this usage of the word with the special user that has complete control over the system. root is designated by the / symbol. This symbol is also used to separate the different levels of the hierarchy.
A directory structure may contain many levels of sub-directories. The following diagram illustrates part of a Linux system directory structure. Files are shown in Italic font.
The full description of the location of a file is called is path. If we wish to describe a file fully, we need to include its path. An example from the previous diagram would be: /home/david/letters/Tax(2004-04-04).
Linux names are case sensitive. Hence the three names tax, Tax and TAX are all different as far as Linux is concerned. Using the wrong case for letters is a common source of errors.
If you have worked with Windows, the Linux directory structure may seem confusing at first. Each system has a single directory system. Drives are located within branches of the structure rather than the structure starting with a drive. Linux goes much further and includes devices such as ports and printers within the directory structure. This follows from the fact that Linux treats files and devices in the same way.
The process of adding components to the Linux directory hierarchy is called mounting and removing them is called unmounting.
The home directory is of special importance in Linux. When a new user is added to the system, Linux creates a sub-directory of the same name in home. For example, if the user dorothy is added, Linux will create the directory /home/dorothy at the same time. This sub-directory is known as the user's home directory. Each user will create a further series of sub-directories in which he/she will store files.
Each user's home directory is private to that user. Apart from the owner of the home directory, the only other user that normally has access to it is the root user.
Each user can access his/her home directory by clicking on the System Menu then Home.
Storage Devices
Know that the devices used by an operating system to store files and folders are the hard disk, diskette, CD-ROM, network drives.
For long term storage, files are stored on various secondary memory devices. These include hard disks, floppy disks, CD-ROMs, DVDs, Zip disks, tape and flash memory. These devices were described in module 1.
Although we can think of directories as containers for files and sub-directories, these are logical structures rather than physical areas on a disk. The actual method of physically storing files on disk and organising them in directories is a very technical topic. From a user's perspective, the important thing is to understand directories as providing a logical method of grouping related files together in one place.
Where computers are connected together through a network, each user will see the disk drives on other computers as part of his/her own directory tree. In fact, if the user has not set up the system, he/she will not necessarily even be aware of the physical location of different parts of the directory tree.
One of the strengths of Linux is that it fully integrates a network into a single system.