Linux File Structure Why, you may be (Zeus web server) asking, are

Linux File Structure Why, you may be asking, are we covering file structure? I know about that already. Well, as withUNIX, files in the Linux environment are particularly important, as they provide a simple and consistentinterface to the operating system services and devices. In Linux,everything is a file. Well, almost! This means that, in general, programs can use disk files, serial ports, printers, and other devices inexactly the same way they would use a file. We ll cover some exceptions, such as network connections, in Chapter 15, but mainly you need to use only five basic functions: open, close, read, write, andioctl. Directories, too, are special sorts of files. In modern UNIX versions, including Linux, even the superusermay not write to them directly. All users ordinarily use the high-level opendir/readdirinterface toread directories without needing to know the system-specific details of directory implementation. We llreturn to special directory functions later in this chapter. Really, almost everything is represented as a file under Linux, or can be made available via special files. Even though there are, by necessity, subtle differences from the conventional files we know and love, thegeneral principle still holds. Let s look at the special cases we ve mentioned so far. DirectoriesAs well as its contents, a file has a name and some properties, or administrative information ; that is, thefile s creation/modification date and its permissions. The properties are stored in the file s inode, a specialblock of data in the file system that also contains the length of the file and where on the disk it s stored. The system uses the number of the file s inode; the directory structure just names the file for our benefit. Adirectory is a file that holds the inode numbers and names of other files. Each directory entry is a linkto a file s inode; remove the filename and you remove the link. (You can see the inode number for a fileby using ln i.) Using the lncommand, you can make links to the same file in different directories. Ifthe number of links to a file (the number after the permissions in ls -l) reaches zero, the inode and thedata it references are no longer in use and are marked as free. Files are arranged in directories, which may also contain subdirectories. These form the familiar file sys- tem hierarchy. Auser, say neil, usually has his files stored in a home directory, perhaps /home/neil, with subdirectories for e-mail, business letters, utility programs, and so on. Note that many commandshells for UNIX and Linux have an excellent notation for getting straight to your home directory: thetilde ~. For another user, type ~user. As you know, home directories for each user are usually subdirecto- ries of a higher-level directory created specifically for this purpose, in this case /home. Note that the standard library functions unfortunately do not understand the tilde notation in file nameparameters. The /homedirectory is itself a subdirectory of the root directory, /, which sits at the top of the hierarchyand contains all of the system s files in subdirectories. The root directory normally includes /binfor sys- tem programs (`binaries ), /etcfor system configuration files, and /libfor system libraries. Files thatrepresent physical devices and provide the interface to those devices are conventionally found in a direc- tory called /dev. See Figure 3-1 for an example of part of a typical Linux hierarchy. More information onthe Linux file system layout is available in the Linux File System Standard, or you can check out manhierfor a description of the directory hierarchy. 92Chapter

WordPress database error: [Table 'armadillowebhosting_com_-_apache.wp_comments' doesn't exist]
SELECT * FROM wp_comments WHERE comment_post_ID = '200' AND comment_approved = '1' ORDER BY comment_date

Leave a Reply