The Linux directory structure, in which all directories are logically only one vertex, i.e./(root), is the starting point for all directories. Below the root is similar to the structure of an upside down tree.
The Linux directory is organized by Category:
Application/usr/bin
Data files to help/usr/share
Configuration file/ect/
Start command/ETC/INIT.D
To access a disk device, you must first mount it to the Linux directory structure. For example, to mount the/DEV/SDA to/usr, use the command mount/dev/sda/usr, and then you can use the disk. There is no relationship between the directory structure and the partition device. Different directories can span different disk devices or partitions.
Relative path and absolute path:
The absolute path begins at the root, such as/data/ect/usr/bin
Not starting with the root is the relative path, such as data./test.txt
UNIX System directory structure allusions
In 1969, Ken Thompson and Dennis Ritchie invented Unix on minicomputer PDP-7. In 1971, they upgraded the mainframe to PDP-11.
At the time, they used a storage disk called RK05, with a volume of about 1.5MB.
It wasn't long before the operating system (the root directory) became larger and bigger, and a disk was not fit. As a result, they added a second set of RK05, and stipulated that the first disk specifically put the System program, the second disk dedicated to the user's own program, so mount Directory point named/usr. That is, the root directory "/" is mounted on the first disk, and the "/usr" directory is mounted on the second disk. In addition, the directory structure of the two disks is identical, the first disk directory (/bin,/sbin,/lib,/tmp ... ) appears again in the/usr directory.
Later, the second plate is full, they have to add a third set of RK05, the directory is mounted to the name of home/home, and specify/usr for storing the user's program,/home for storing the user's data.
Since then, this directory structure has continued. As hard disk capacity becomes larger, the meanings of each directory are further clarified.
/: Storage System program, which is the UNIX program developed by T/T.
/usr: programs developed by UNIX system vendors, such as IBM and HP.
/usr/local: Store the user's own installed program.
/OPT: In some systems, it is used to store programs developed by third-party vendors, so it is named option, meaning "optional".
Linux directory hierarchy standard FHS
FHS Full Name (Filesystem Hierarchy standard), Chinese meaning is the directory hierarchy, is the Linux directory specification standards.
FHS defines the two-tier specification: The first layer is what file data should be stored in the "/" directory, such as/ect directory placement system configuration file/ect/exports,/ect/hosts, and/bin and/sbin placement programs and system commands.
The second tier is defined for the two sub-directories of/USR (Unix software Resource) and/var.
/bin: Common binary commands in the directory, such as LS,CP,MKDIR,RM and/usr/bin similar
/boot:linux the kernel and the file directory required by the boot system program.
/dev: Device files directory, such as disk, sound card
/dev/null: Empty equipment with cat/dev/null >./test.txt to clear the contents of the file
/etc: The configuration file default path to the binary installation package and the directory where the service startup command resides.
Home directory default data storage directory for normal users
/lib: library file directory
/root: Home directory for Superuser Root
/lost+found: When the system crashes unexpectedly or the machine shuts down unexpectedly, some file fragments are generated here. During boot-up, the fsck tool checks here and repairs the corrupted file system. When a problem occurs in the system, there may be files that are moved to this directory, which may need to be repaired manually or moved to the original location.
/MNT: Typically used to temporarily mount a storage device mount directory, such as a cdrom,u disk directory. Direct insertion of the optical drive is not available, it must be mounted and used. The mount point is the file system's (device) entry.
/OPT (option): In some systems, it is used to store programs developed by third-party vendors, so it is named option, meaning "optional".
/proc: A virtual file system. The/proc file system is a mechanism used by kernel and kernel modules to send information to processes (so called/proc). This pseudo file system allows you to interact with the internal data structure of the kernel, get useful information about the process, and change the settings (by changing the kernel parameters) in the run (on the fly). Unlike other file systems,/proc exists in memory, not on the hard disk.
/sbin: Mostly the place where the system management commands are designed, which is where the root user can execute commands.
/tmp: Temporary file directory, sometimes a temporary file is generated when the user runs the program. /tmp is used to store temporary files, the permissions are very special. The/var/tmp directory is similar to this directory
/var: This directory content is constantly changing. /var/log directory is used to store the system log,/var/www directory is defined Apache server site storage directory,/var/lib used to store some library files, such as MySQL database.
Linux directory structure detailed (a)