Deeply Understand The Directory structure of The Linux File System
Source: Internet
Author: User
Keywordslinux linux file system linux file system structure
Introduction
For every Linux learner, understanding the directory structure of the Linux file system is an important step to learn Linux well. To understand the standard of the Linux file directory structure and the detailed functions of each directory is for us to use the Linux system well. Regardless of the importance, let's start to understand the relevant knowledge of Linux directory structure.
When using Linux, if you pass ls -l /, you will find that there are many directories under /, such as etc, usr, var, bin... etc. In these directories, we Go inside and find that there are also many directories or files. The file system looks like a tree structure under Linux, so we can call the structure of the file system a tree structure.
The file system is used to organize and arrange file access, so it is visible. In Linux, we can use tools such as ls to view its structure. In the Linux system, all we see are tree structures; For example, the operating system is installed in a file system, and it appears as a tree structure starting from /. The top of the Linux file system is /, we call / the root of Linux, which is the file system of the Linux operating system. The entry of the Linux file system is /, and all directories, files, and devices are under /. / is the organizer of the Linux file system and the top leader.
Since Linux is an open source code, major companies and organizations do their own operations and programming based on the core code of Linux. This makes the directory under the root different. As a result, individuals cannot use other people's Linux system PCs. Because you don't know some basic configuration, where are the files. . . This caused confusion. This is the reason why the FHS (Filesystem Hierarchy Standard) organization was born. This organization is a spontaneous group of Linux enthusiasts, mainly to make some basic requirements for Linux, so that the operator will not become Linux illiterate by changing a host.
According to the official FHS document, their main purpose is to let users know that the installed software is usually placed in that directory, so they want independent software developers, operating system producers, and users who want to maintain the system. , Are able to follow FHS standards. In other words, the focus of FHS is to regulate what kind of data should be placed in each specific directory. This has many benefits, because the Linux operating system can develop a unique style that developers want under its existing appearance (the directory structure remains unchanged).
In fact, FHS has been continuously revised based on past experience. FHS defines the directory into four interactive forms according to the frequency of use of the file system and whether users are allowed to change it at will. It's a bit like this:
Variable (variable) /var/mail (user mail box) /var/spool/news (newsgroup)
four types
1. Shareable:
It can be shared with other systems for mounting directories, so data including executable files and user emails can be shared with other hosts on the network for mounting directories;
2. Unshareable:
The device files or socket files related to the program running on your own machine are only related to your own machine, so of course it is not suitable for sharing with other hosts.
3. Constant:
Some data does not change frequently, and does not change following the distribution. For example, library, file description file, host service configuration file managed by system administrator, etc.;
4. Variable:
Data that changes frequently, such as log files, newsgroups that general users can receive by themselves, etc.
In fact, for the directory tree structure, FHS only defines what data should be placed under the three-level directories, which are the definitions of the three directories below:
Contents placed / (root, root directory): related to booting the system /usr (unix software resource): related to software installation/execution /var (variable): Related to the system operation process 2. The meaning and content of the root directory (/) The root directory is the most important directory of the entire system, because not only all directories are derived from the root directory, but the root directory is also related to boot/restore/system repair and other actions. As the system needs specific boot software, core files, programs needed for booting, library and other file data when booting the system, if there is an error in the system, the root directory must also contain a program that can repair the file system. Because the root directory is so important, in terms of FHS requirements, he hopes that the root directory should not be placed in a very large partition, because the larger the partition, the more data you will put, so the partition where the root directory is located There may be more opportunities for errors.
Therefore, the FHS standard recommends that the partition where the root directory (/) is located should be as small as possible, and the software installed by the application should not be placed in the same partition as the root directory. Keep the root directory as small as possible. Not only is the performance better, but the file system where the root directory is located is also less prone to problems. To put it bluntly, the root directory is the same as the Windows C drive.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.