[Linux] Linux file directory structure

Linux file directory structure

LinuxIn , its file directory structure is a structure similar to a multi-fork tree, all directories are under / (root directory), each non-leaf node represents a directory, and a leaf node represents a file.

The general structure looks like this:

insert image description here

insert image description here

  • usr : Short for "Unix Software Resource", this directory contains applications and files used by the user, not those used by the system, for example: non-essential applications are located in the /usr/bin directory instead of the /bin directory , non-essential system administration binaries are located in the /usr/sbin directory instead of the /sbin directory.

  • bin : bin is the abbreviation of Binarity (binary file), which stores the most commonly used programs and instructions.

  • sbin : s means super (super) only system administrators can use the program and means.

  • boot : stores Linuxthe kernel files used at startup, including compressed kernel image files, virtual file system image files, and boot configuration grubfiles.

  • dev : Abbreviation of Device (equipment), which stores Linux device files. Since Linuxeverything below is a file, Linuxthe way to access a device is the same as accessing a file, and a device is also regarded as a file, and accessing this file is equivalent to accessing the corresponding device!

  • etc : System global configuration files, which will affect all users. Improper changes to files in this directory may cause the system to fail to start. User-specific configuration files are located in each user's home directory, not in this directory .

  • home : stores the user's home directory, and the directories in the user's home directory are named after the user's account.

  • lib : stores the libraries required by binary files (such as C/C++ libraries), and almost all applications need to use these shared libraries.

  • lost+found : This directory is used to store fragments of files when the system is abnormal, so as to facilitate recovery. Generally, it is empty. After the system is shut down illegally, some files are stored here.

  • media : LinuxThe system will automatically recognize some devices, such as U disk, CD-ROM, etc. After recognition, the Linuxrecognized device will be mounted to this directory.

  • mnt : The system provides this directory to allow users to temporarily mount other file systems. We can mount the CD-ROM drive on /mnt, and then enter this directory to view the contents of the CD-ROM drive.

  • opt : It is empty by default, when we install additional software, we can put it in this.

  • proc : procIt is the abbreviation of Processes (process). /proc is a pseudo file system (that is, a virtual file system), which stores a series of special files of the current kernel running state. This directory is a virtual directory, which is the system For memory mapping, we can obtain system information by directly accessing this directory. The content of this directory is not on the hard disk but in memory, and we can also directly modify some files in it.

  • root : The home directory of the root user. The root user is different from ordinary users in that it has a separate home directory.

  • run : This directory is fairly new and provides a standard place for applications to store needed temporary files such as sockets and process IDs. These files cannot be stored /tmpin , because /tmpthe files in will be deleted, and it is also a temporary file system, which stores information after the system starts. When the system is restarted, the files in this directory should be deleted or cleared.

  • srv : Mainly used to store services or data provided by this machine or this server. (this is just a suggestion)

  • sys : This is linuxa big change in the 2.6 kernel. A new file system in the 2.6 kernel is installed in this directory sysfs. The file system is a visual reflection of the kernel device tree. When a kernel object is created, the corresponding files and directories are also in the kernel object subsystem.

  • tmp : This directory stores temporary files, and the system will automatically clean up the files in this directory when it restarts (different Linux systems have different cleaning times, CentOS cleans up files ten days ago after restarting, and Ubuntu cleans up after each restart), so do not Put important files in this directory.

  • var : This directory contains files whose content changes while the system is running, such as logs, offline files, and temporary email files, and is sometimes a separate partition.

Guess you like

Origin blog.csdn.net/qq_65207641/article/details/130495905