One of the best ways to come to terms with a new operating system is to get familiar with the way that the system organizes its files. Files are usually stored in directories which are arranged in a hierarchal tree structure. This is commonly called the directory structure.
Here is an example of a common Linux directory structure . This should look similar to what you would see with most other visual operating systems.
/
- bin
- boot
- dev
- etc
- home
- lib
- lost+found
- mnt
- opt
- proc
- root
- sbin
- tmp
- usr
- var
Linux uses "The Filesystem Hierarchy Standard". There will be slight variations but a lot of what you see here is common to many Unix-based systems. Most Linux distributions such as Red Hat, Mandrake, Suse, Debian, etc, use this file system, or at least something very close to it. It should be noted, you can build your own Linux system any way that you want (Free software by definition). There is no strict requirement that you use any particular structure, however, other users will have difficulty using your system and it could turn into a maintenance nightmare very quickly.
Some of the directories shown here will be of little interest to many Linux users. For most users, other then root, their primary concern will be their home directory which can be structured any way that is convenient.
Windows users will notice that there are no hard drive distinctions. The directory structure shown actually represents a system which has 3 hard drives. With Unix-based systems, drives are not shown. File systems are mounted to particular drives but for the user, the actual implementation is transparent. This approach allows files to be presented to the user in a more centralized view even though the files may actually be spread out among several hard drives and partitions. The result is better security and protection against system crashes and data loss.
Lets take a look at each directory and what it is used for:
"/" This is a mandatory directory. It is the beginning of the filesystem and includes all of the directories beneath it. If you type cd / and then ls you will see a listing of all directories on the system (That you have permission to see). This should be similar to the graphic above.
/bin This is a mandatory directory. This directory contains the binaries that are used in single-user systems. For multi-user systems these binaries are usually stored in the /usr/bin directory. When you type a command such as ls or chmod it is usually directed to one of these two directories where the program exists.
/boot This is a mandatory directory. This directory stores the files which are used for the system startup except for the configuration and map installer. Frequently the kernel is stored here especially if more then one kernel is installed.
/dev This is a mandatory directory. The device files, sockets, and named pipes are stored here.
/etc This is a mandatory directory. This directory, pronounced "et-see", holds the configuration files for the system. It is divided into many subdirectories.
/home This is an optional but widely used directory. The other variation on the /home directory is to use a subdirectory in the /var directory. This is where users will do most of their work. Each user is given their own directory in the /home directory which is theirs to organize and use as they choose. Frequently web server document roots are located in the /home directory. (ex. /home/public_html or /home/www/public_html) The /home directory is designed to host dynamically changing files and usually occupies one of the larger partitions on a hard disk.
/lib This is a mandatory directory. Shared libraries needed at bootup or which need to be run by top level commands are stored here. Libraries which support users are usually stored in the /usr/lib directory.
/mnt This is an optional but very popular directory. This directory contains mount points for external storage devices. To access a floppy disk drive you cd to mnt/floppy. Once an external drive is accessed, its file system is mounted to the host system in the /mnt directory.
/opt This is an optional directory. It is a directory intended to contain software packages which are added to the original system. On my system it is present, but empty.
/proc This is an optional but widely used directory. It contains a virtual filesystem which is created and used by the currently running kernel. It is deleted when the system is shut down. Frequently, monitoring programs use the /proc directory to obtain information on currently running processes and other environmental information.
/root This is an optional but widely used directory. It is often created to eliminate clutter from the "/" directory. It contains configuration files for the root user.
/sbin This is a mandatory directory. This directory was originally a place to store static binaries. It has been expanded to include administrative binaries which are used by the root user only.
/tmp This is a mandatory directory. This directory is used by programs to store temporary files. Files which are located here are often flushed on reboot or flushed periodically.
/usr This is a mandatory directory. The /usr directory is designed to store static, sharable, read-only data. Programs which are used by all users are frequently stored here. Data which results from these programs is usually stored elsewhere (often /var).
/var This is a mandatory directory. This directory stores variable data like logs, mail, and process specific files. Most, but not all, subdirectories and files in the /var directory are shared. This is another popular location for web server document roots.
No comments:
Post a Comment