FHS
Filesystem HierarchyStandard (file system hierarchy Standards), most Linux versions Use this type of file organization, similar to Windows The file directory of the C drive in the operating system,FHS tree structure file. FHS Defines the purpose of each region in the system, the minimum required composition of the files and directories, and also gives the exception handling and contradictory processing.
The four most basic forms of interaction:
| |
Shareable (shareable) |
non-shareable (unshareable) |
| static (static) |
/usr (software placement) |
etc (config file) |
| /opt (third-party software) |
/ Boot (boot with kernel file) |
| variable (variable) |
/ Var/mail (user mailbox) |
/var/run (program related) |
| /var/spool/news (News Group) |
/var/lock (file lock related) |
There are two definitions for the differences between files: shareable and non-shareable files, mutable and static files. in general, files that differ in these areas should be placed in different folders. This makes it convenient to keep files of different uses on different file systems.
Shareable: Files are files that can be saved on one host and used on another host.
Non-shareable: Files that cannot be shared. For example, the files under the user's home folder are shareable, and the device lock files are not shareable.
Static files: includes binaries, library files, documents, and other files that will not change when the system administrator does not intervene.
mutable files: non-static files.
Directory structure diagram
Common Directory Description Table
| Directory |
Describe |
| / Root File System |
| Bin |
A binary file that holds commands that ordinary users can use |
| Boot |
Some of the core files used when starting Linux |
| Dev |
Device files |
| etc |
Host-specific system configuration files |
| Home |
User home folder |
| Lib |
Dynamically linked shared libraries that act like. dll files in Windows |
| Media |
Removable device mount point, the current operating system will usually put a USB stick and other devices automatically mounted to the folder |
| Mnt |
Temporary place to mount the file system |
| Opt |
Most third-party software is installed to this location by default |
| Proc |
It is a virtual file system that exists in memory. It holds the kernel and process state information. |
| Root |
Root User's home folder |
| Sbin |
Executables for super users, many of which are system administration commands |
| Tmp |
Temporary files |
| Usr |
Level Two hierarchy |
| Var |
Variable data |
| / usr Hierarchical Structure |
| Bin |
Most user lives |
| Include |
C program contains the header file |
| Lib |
Library |
| Local |
Local hierarchy (empty after the entire system is installed) |
| Sbin |
Non-critical system binaries |
| Share |
Stand-alone and system-architecture data, with data that can be read almost anywhere in the hardware architecture |
| / var Hierarchical Structure |
| Cache |
Application Cache Data |
| Lib |
mutable state information |
| Local |
Variable data for/usr/local |
| Lock |
Lock file |
| Log |
Log files and folders |
| Opt |
Variable data for/OPT |
| Run |
About the data that is running the process |
| Spool |
Application Spool Data |
| Tmp |
Temporary files reserved between system two launches |
/usr is a second important part of the file system. /usr is a shareable, read-only data. This means that/usr should be able to be shared between various FHS compatible hosts and prohibit write. Any host-specific information or amount of change over time is saved elsewhere. Large packages prohibit the use of direct subfolders in the/USR hierarchy.
/var contains variable data files. This includes spool folders and files, administrative and log data, and staging and staging files.
Some parts of/VAR cannot be shared between different systems. For example,/var/log,/var/log, and/var/run. Other parts can be shared, especially like/var/mail,/var/mail,/var/cache/man,/var/cache/font, and/var/spool/news.
Suggestions:
1, the root system should be as small as possible.
2, the application can not be created at any time or require to save special files or subfolders under the root folder.
Linux directory Structure description