152 153




Linux Unleashed, Third Edition:Using the File System





-->















Previous
Table of Contents
Next




Directories: An Overview
Linux, like many other computer systems, organizes files into directories. You can think of directories as file folders and their contents as the files. However, there is one absolutely crucial difference between the Linux file system and an office filing system. In the office, file folders usually don’t contain other file folders. In Linux, file folders can contain other file folders. In fact, there is no Linux “filing cabinet”—just a huge file folder that holds some files and other folders. These folders contain files and possibly other folders in turn, and so on.
Parent Directories and Subdirectories
Imagine a scenario in which you have a directory, A, that contains another directory, B. Directory B is then a subdirectory of directory A, and directory A is the parent directory of directory B. You will see these terms often, both in this book and elsewhere.
With Linux, there is no real limit to the number of directories and subdirectories you have on your system. The same applies for the number of files. As long as there is space on the hard drive, Linux will be able to save files and directories. A directory can have an unlimited number of subdirectories, and they themselves can have an unlimited number of subdirectories, and so on. Each directory and subdirectory can have an unlimited number of files. The key to understanding the way Linux organizes files and directories is recognizing that there is only one top-level directory, from which all others are subdirectories.
The Root Directory
In Linux, the directory that holds all the other directories is called the root directory. This is the ultimate parent directory; every other directory is some level of subdirectory. The root directory has a special symbol, /, which is used to show it is the top level. You’ll see how all other subdirectories branch off from the root directory in the next few sections.
From the root directory, the whole structure of directory upon directory springs and grows like some electronic elm tree. This is called a tree structure because, from the single root directory, directories and subdirectories branch off like tree limbs. You’ll also hear this called a hierarchical directory structure because there is a hierarchy of levels of directories, with the highest level as the root directory.
Just a quick word about file systems. You’ll see the words file system used throughout this book. That’s because UNIX has always referred to directory structures as file systems. There’s quite a bit of history behind it, but all the directories on your Linux system are your system’s file system. That’s where Linux stores the files.
How Directories Are Named
Directories are named just like files, and they can contain upper- and lowercase letters, numbers, and characters such as -, ., and _. Essentially, to Linux a directory name is a file because it makes no distinction between the two. You can name directories the same, as long as they are not in the same parent directory (to prevent having two directories called “data” under the same parent directory), but you can have any number of directories called “data” in your file system as long as they don’t share parents.
The slash (/) character is used to show files or directories within other directories. For instance, usr/bin means that bin is found in the usr directory. Note that you can’t tell from this example whether bin is a file or a directory, although you know that usr must be a directory because it holds another item—namely, the directory bin. When you see usr/bin/grep, you know that both usr and bin must be directories, but again, you can’t be sure about
grep. The ls program often shows directories followed by a backslash (sometimes this requires the -F option)—for example, to show that fido is a directory, ls shows it as fido/. This notation implies that you could have, for instance, fido/file; therefore, fido must be a directory.
As mentioned earlier, the root directory is shown simply by the symbol / rather than mentioned by name. It’s very easy to tell when / is used to separate directories and when it’s used to signify the root directory. If / has no name before it, it stands for the root directory. For example, /usr means that the usr subdirectory is found in the root directory, and /usr/bin means that bin is found in the usr directory and that usr is a subdirectory of the root directory. Remember, by definition the root directory cannot be a subdirectory.



Previous
Table of Contents
Next














Wyszukiwarka

Podobne podstrony:
152 153
152 153
152 153
153 KOSMICZNI OGRODNICY
23 (152)
152 00
153 09
Mazowieckie Studia Humanistyczne r2001 t7 n2 s141 152
SHSpec 153 6205C29 Security Check Prepchecking
152 ind (2)
index (152)

więcej podobnych podstron