Follow AIGC to explore the Linux system directory structure: In-depth understanding of the core of the operating system (3)

1 Introduction

If it is Linuxa desktop user and MacOSuser, this step is easy to understand, and Windowsthe user needs to switch and get used to it. The mac system directory is indeed not much different from linux, here is a brief description of the difference between Linuxand Windows, directly on the picture!

2. Windows system directory

The Windows system directory structure uses drive letters to represent different storage devices and partitions, and there are some specific directories for storing core system files, user folders, program folders, and system reserved folders. This directory structure provides users with a convenient way to manage files and install applications.
As shown in the figure below, this is the common C drive, D drive, etc. The biggest feature is convenience, easy to understand and use , followed by:

  1. Hierarchical structure: Windows system directories adopt a hierarchical structure, starting from the root directory (C:\), each directory has a specific function and purpose, forming a hierarchical structure.

  2. Core file storage: The Windows system directory (usually C:\Windows) is where the core files and system components of the operating system are stored. These files include the operating system kernel, system drivers, system configuration files, etc., and are necessary to maintain the normal operation of the system.

  3. Application directories: Windows system directories also include directories for installing and storing installed applications, such as C:\Program Files and C:\Program Files (x86). These directories are used to store executable files, library files, configuration files, etc. of the application.

  4. User personal directory: There is a directory named C:\Users in the Windows system directory structure, which is used to store each user's personal files and settings. Under this directory, each user has a subdirectory named after their user name, which is used to store their personal files such as documents, downloads, pictures, music, etc.

  5. Shared directory: The Windows system also provides some shared directories for sharing files and resources among multiple users. This includes the C:\ProgramData directory, which stores application data and settings shared by all users.

  6. Temporary file directory: The Windows system directory structure contains a directory for storing temporary files, usually C:\Windows\Temp. This directory is used to store temporarily generated files, such as temporary download files, temporary installation files, etc.

  7. Customizability: Although the Windows system directory structure has some default regulations, users can usually customize the location and name of the directory to a certain extent. For example, you can change the location of a user's home directory or use a different hard disk partition for certain directories.

3. Linux system directory

The author of the Linux system thinks that the biggest feature is the root directory, /a centralized directory structure that starts and diverges, and the biggest feature is logic !

Compared with the Win system, the directory structure of the Linux system uses the root directory (/) as the starting point instead of the drive letter. There are some specific directories under the root directory for storing different types of files and configurations. The following is an analogous description of the Linux system directory:

  • /bin: Similar to the program folder of Windows, it stores the basic commands and executable files required during system startup and operation.
  • /etc: Similar to the configuration folder of Windows, it contains system configuration files, such as network configuration, user account and password, configuration of software package management tools, etc.
  • /home: Similar to the Windows user folder, each user has a subdirectory named after their user name, which is used to store personal files and settings.
  • /libAnd /lib64: Similar to the library folder of Windows, it stores the shared library files required by the system to run, and provides various functions for the programs in the system.
  • /dev: Similar to the Windows device folder, including device files, everything in Linux is a file, and interacts with the device through the files in the /dev directory.
  • /var: Similar to the variable data folder of Windows, it stores frequently changing data, such as log files, database files, etc.
  • /tmp: Similar to the Windows temporary folder, it is used to store temporary files, which are usually cleared after the system restarts.
  • /proc: Similar to the Windows system folder, it provides access to kernel and process information, which can be read from specific files in this directory.
  • /sbin: Similar to the Windows system administrator folder, it stores some basic commands and executable files used by system administrators.
  • /usr: Similar to the Windows application folder, it is the main installation location of user software, including user-installed applications, library files, documents, and other resources.

3.1 Key 1: multiple /bin

The careful guy found out why there are multiple /bin, /lib... Here is an example of /bin, and so on

  • /bin:/bin is the abbreviation of Binary, and it is a directory used to store basic commands and executable files required during system startup and operation. These commands are necessary for the basic functions of the system, so the /bin directory usually contains some core tools, such as ls, cp, mv, rm, etc. These commands are available at system startup and do not depend on the mounting of other filesystems.

  • /usr/bin: /usr/bin is the main installation location for user software and contains executable files for user-installed applications. When users install additional software, they are usually installed into the /usr/bin directory or its subdirectories. These applications can be system-provided or user-installed. Unlike the /bin directory, executables in the /usr/bin directory are non-system-critical and are not required for the startup process.

3.2 Key 2: What is the connection between the directories

Here is a horizontal comparison in combination with Linux /directories or Windows drive letters:

  • The relationship between the drive letter of the Windows system and other directories:

C:\Each drive letter (such as , etc.) in the Windows system D:\is an independent file system root, and they can have their own directory structure. Each drive letter has a structure similar to the Linux root directory, including various directories such as the Windows directory, Program Files directory, and Users directory. These directories and files exist relative to their respective drive letters, and they can be accessed by adding drive letters and path names.

  • The relationship between the root directory of the Linux system and other directories:

The root directory ("/") of the Linux system is the starting point of the entire file system, including all other directories and files. Other directories exist relative to the root directory, and they are located and accessed using the root directory as a reference point. For example, /bin, /home, /etcand other directories are subdirectories under the root directory, and they can be accessed by adding path names.

  • Main difference:

    • In the Linux system, the root directory is a unified starting point, the entire file system is organized in a hierarchical structure, and other directories are subdirectories relative to the root directory. In the Windows system, each drive letter is an independent starting point, and each drive letter has its own directory structure.
    • The Linux system uses a single root directory to manage the entire file system, while the Windows system allows multiple independent drive letters, and each drive letter can have its own file system and directory structure.
    • The directory structure in the Linux system is relatively uniform and consistent, while the directory structure in the Windows system is relatively flexible and diverse, and there may be similar directories under different drive letters.
    • In the Linux system, the root directory is a single root node represented by "/", while in the Windows system, each drive letter can be regarded as the root node, such as C:\, D:\, etc.

What is highlighted here is the logic just mentioned . The author believes that it is also related to their usage. Win systems are generally used as personal computers for personal use, for the convenience of use and easy operation; Linux systems are generally used as server operating systems, emphasizing high energy, low consumption and multiple users, so more attention is paid to system operation logic in management, use and maintenance.

4. Discussion

As a representative of open source operating systems, Linux plays a huge role in the computing field. To understand Linux in depth, start with its core building blocks, which is the directory structure. This article roughly covers the directory structure of the Linux system, reveals the functions and functions of each directory, and compares it horizontally with Windows. Linux is a multi-user, multi-tasking operating system, and its directory structure provides a unified organizational structure for users and systems.

The following are some hen important directories, please pay attention, and you should avoid modifying their contents at will when using the Linux system:

Table of contents describe
/bin Store the basic commands and executable files required during system startup and operation.
/etc Store system configuration files, such as network configuration, user accounts and passwords, etc.
/home The user's home directory, with each user having a subdirectory named after their username.
/lib Store the shared library files required by the system to provide functions for the programs in the system.
/usr The main installation location for user software.
/was Store frequently changing data, such as log files, database files, etc.

It’s okay for users without permission, remember not to modify randomly if you have root

A new fan came to ask rm -rf /*me before, my evaluation is as a novice, the person who told you this order must be evil. This kind of thing is like pressing on the keyboard of the windows system Alt+F4. Don’t use it without thinking about things that are fancy but don’t understand.

Guess you like

Origin blog.csdn.net/weixin_48093827/article/details/131720649