-->
Previous | Table of Contents | Next |
Under Linux, a file can be one of several types:
Were not going to spend a lot of time discussing each of these file types; you should be able to see the difference between them in the short explanations here. If you want more information about UNIX file types, check out one of the UNIX texts listed in Appendix A.
Ordinary files win the Linux prize for truth in advertising; they tend to be rather ordinary. Generally speaking, youll spend most of your time working with ordinary files of some sort:
Directories are, well, directories. Under Linux, a directory is also a file that contains information about the directory. (Talk about the ultimate in self-referential logic ) Youll learn more about directories soon, but the important thing to know is that directories can have the same sort of limitationsi.e., permissionsas can files.
A link is a reference to another file within the filesystem. This allows a file to be in two (or more) places at the same timein its original file location and at the reference elsewhere in the filesystem. Youll learn more about links later in this chapter.
In a sense, youve already covered this type of file in Chapter 2, when you learned how Linux refers to various portions of the PC architecture, such as /dev/hda for the hard drive. These references are called device files, and they are used by Linux to represent physical portions of the PC. Under Linuxand under UNIX, for that mattereverything is a file, whether it a collection of data, a device file representing a physical piece of hardware (such as a printer, disk drive, etc.), or the kernel of the operating system itself. Similarly, even if youve installed Linux on a PC with multiple hard drives, youll never see a difference in the way Linux treats the separate drives; there will be only one large filesystem.
Most important Linux commands deal with the management of files and directories. Therefore, its important that we take a moment and explain exactly how Linux treats these files and directories.
Like DOS, Windows, the Macintosh OS, and other versions of UNIX, Linux stores files in a hierarchical fashion; files are stored in directories, and directories (or subdirectories) are stored in other directories. The only directory thats not a subdirectory of another directory is the root directory. This directory doesnt have a name (like bin, as seen in Table 4.1). Instead, the root directory is indicated by a slash (/). This is the opposite of MS-DOS, which uses the backslash (\) to indicate the root directory. The directory above the current directory in the hierarchy is called the parent directory. The Linux installation process creates quite a few directories, including the main subdirectories of the root directory. Its handy to know whats contained in these directories; theyll be the first place to look for specific files. Table 4.1 lists the main directories found in the root directory.
Directory | Contents |
---|---|
bin | Binary files |
boot | Information needed to boot the system |
cdrom | CD-ROM drive, if Linux supports your CD-ROM drive |
dev | Device drivers |
etc | Miscellaneous files, mostly used in system administration |
home | The home directory for users |
lib | Programming libraries |
tmp | Temporary storage of temporary files |
usr | Commands |
var | System definitions |
NOTE: Case counts in Linux across the board, as youll learn time and time again. (This is different from DOS, where case doesnt matter.) If you tell Linux to look for a directory named BIN, the system wont find this directory. However, if you tell Linux to look for bin, the system will find it.The same goes for Linux commandswhen we tell you to use the cd command, we mean cd, not Cd, CD, or cD. Again, this is different from DOS.
Depending on how you installed Linux, you may also have a directory called dos, dosc, or something similar, which contains the MS-DOS partition on your hard drive.
Previous | Table of Contents | Next |