Earlier in the book, we talked about disk sharing using read-only files. Table 20-2 contains a more complete directory listing. Directories where content could potentially be read-only shared are marked in gray.
Directory structures vary with distribution.
Table 20-2. Typical Linux directory structure
Directory | Description |
---|
/ | Referred to as the "root" directory. The root directory normally contains all other directories. When a directory structure is displayed as a tree, the root directory is at the top. It is generally considered a bad idea to store single files in this directory. |
/bin, /usr/bin | Contains many important Linux commands such as the shells (ash, bash, and csh) and essential utilities such as grep, gzip, ping, and su. /usr/bin generally contains applications for system users. The distribution of programs between /bin and /usr/bin depends on the distribution. |
/boot | Contains information needed at boot time, such as the Linux kernel. |
/dev | Contains device definitions. In Linux, devices are treated as a file. Files in /dev/ serve as gateways to physical computer components such as a printer, modem hard disk, and so forth. Even your terminal is treated as a device file. A popular device is /dev/null, which is useful for sending output to be deleted. |
/etc | Contains the configuration files for the Linux system. Most of these are text files and therefore are easy to edit. Although Linux distributions ship with configuration tools, editing the files manually in /etc is often necessary. |
/home | The top-level directory for users' home directories. For each user there is a separate directory within /home. If your user name is JOHN your home directory will be /home/john. You can always return to your home directory by typing "cd" at the shell prompt. |
/lib | Contains shared libraries for programs that are dynamically linked. |
/lost+found | Where Linux keeps any files it restores after a system crash or when a partition has not been unmounted before a system shutdown. It provides a means of recovering files that otherwise would have been lost. |
/opt | Contains additional software. /opt is home for many large packages such as StarOffice, KDE, and Oracle. |
/proc | Contains the process file system. /proc contains all the "virtual files" representing different aspects of your system such as your CPU, RAM, and so forth. |
/sbin | Contains programs that are reserved for the superuser and are needed to start the system. |
/sbin/init.d | Contains scripts used to start the system. These scripts are executed directly or indirectly by /sbin/init, the father of all processes. |
/tmp | Contains temporary files. Many applications use this directory to hold some information. |
/usr | Contains user commands and applications. Also their source code, pictures, and documentation. /usr can be the largest directory on a Linux system. It can be useful to have this directory in a separate partition. |
/var | Contains files that change constantly when the system is running, such as log files and mail spools. |