Linux - directory structure and basic file operations

2. Linux directory structure

Before talking about the Linux directory structure, you must first be clear that the difference between the Linux directory and the Windows directory may not be much different from the general operation experience, but it is completely different from their implementation mechanism. .

A difference is reflected in the relationship between directories and storage media (disk, memory, DVD, etc.). In the past, Windows has always been based on storage media, mainly drive letters (C drive, D drive...) and partitions. To achieve file management, and then the directory is below, the directory is not so important, and user files other than system files are placed anywhere in any directory. It doesn't matter much. Therefore, usually after Windows has been used for a period of time, the file directory on the disk will appear disorganized (except for a few users who are good at organizing). However, UNIX/Linux is just the opposite. UNIX is mainly based on directories, and Linux also inherits this excellent feature. Linux builds the entire system in the form of a tree-shaped directory structure, which can be understood as the skeleton of a user-operable operating system. Although essentially both the directory structure and the operating system kernel are stored on the disk, logically speaking, the Linux disk is "mounted" (mounted) on the directory, and each directory can not only use local disk partitions file system, you can also use a file system on the network. For example, a network file system (Network File System, NFS) server can be used to load a specific directory, etc.

 

 1. FHS Standards

The directory structure of Linux is complex and complicated, and simple and simple. The complication is that because the normal operation of the system is based on the directory structure, for beginners, most of the directories in it do not know their function, whether it is important or not, especially for those who used to be heavy Windows users, they will struggle for a long time. , about where the software I installed is located. It's simple because most of the directory structure is prescriptive (FHS standard), dead, and when you get the hang of it, everything you do in it becomes orderly.

FHS (English: Filesystem Hierarchy Standard Chinese: Filesystem Hierarchy Standard), most Linux versions use this file organization form, FHS defines the purpose of each area in the system, the minimum required files and directories, and also gives Exception handling and conflict handling.

FHS defines two layers of specifications. The first layer is,  / what file data should be placed in the following directories, such as  /etc setting files should be placed, /bin and  /sbin executable files should be placed, and so on.

The second level is   defined for the subdirectories of these two directories /usr . /varFor example  /var/log put system log files, /usr/share put shared data and so on.

 

 

If you don't understand this, you can try the most realistic and intuitive way, and execute the following command:

$ tree /

Regarding the FHS mentioned above, there is another very important content that you must understand. FHS is based on the experience of countless Linux users and developers in the past, and will be maintained and updated. FHS is based on the frequent use of the file system. And whether to allow users to change at will (note that it is not impossible, don't be afraid of these during the learning process), define the catalog as four interactive forms, as shown in the following table:

Enter image description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325096216&siteId=291194637