


The Linux file system is a tree structure, that is, there is only one root directory, which contains information about lower-level subdirectories or files; the subdirectories can contain information about more subdirectories or files, so that one layer at a time It extends layer by layer to form an upside-down tree. The top level of the Linux file system starts with the root directory. The system uses "/" to represent the root directory. Below the root directory can be either a directory or a file, and each directory can contain (sub) Directory or file.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
The files in the Linux file system are a collection of data. The file system not only contains the data in the file but also the structure of the file system. All the files, directories, soft links and files seen by Linux users and programs Protection information etc. are stored in it.
The structure of the Linux file system
Like DOS and Windows systems, Linux also uses a tree directory structure to organize and manage files. All files are hierarchical and divided. They are organized in layers to form a tree-like hierarchical structure. In the entire tree structure, there is only one root directory located in the root partition. Other directories, files and external devices (including hard disks, floppy drives, optical drives, modems, etc.) files start from the root directory and are mounted under the root directory. , that is, the entire Linux file system starts from the root directory, and all other partitions are mounted to a directory in the directory tree. Access to these partitions can be achieved by accessing the mount point directory.
The Linux file system adopts a tree directory structure, that is, there is only one root directory, which contains information about lower-level subdirectories or files; subdirectories can contain information about more subdirectories or files. , which extends layer by layer; forming an upside-down tree. In a directory tree, both the root node and the intermediate nodes must be directories, and files can only appear as leaf nodes. Of course, directories can also be leaf nodes.
The top level of the file system starts from the root directory. The system uses "/" to represent the root directory. The directory below the root directory can be , or it can be a file, and each directory can contain (sub)directories or files. Repeatedly, a huge file system can be formed.
Explanation
In Linux, directory names or file names are case-sensitive, such as HaiCoder, haicoder and Haicoder are 3 different directories or files.
The complete directory or file path is composed of a series of directory names, each directory is separated by "/".
In the file system, there are two special directories. One is the working directory of the user, which is the current directory, which can be represented by a dot "."; the other is the current directory. The upper-level directory, also called the parent directory, is represented by two dots "...".
If a directory or file name starts with a dot, it means that the directory or file is a hidden directory or file. That is, when searching in the default mode, the directory or file will not be displayed.
The contents of each subdirectory of the Linux system
Path | Main content |
---|---|
/root | Necessary files for booting the system, file system mounting information, system repair tools and backup tools, etc. |
/usr | Command program files, program libraries, manuals and other documents that do not need to be modified during normal operations |
/var | Frequently changing files, such as spool directories for printers, mail, news, etc., log files, formatted man pages and temporary files, etc. |
/home | The user’s home directory. User data is usually stored in this directory. |
/proc | The contents of the directory are the contents of the directory after the system starts. Created in memory, it contains kernel virtual file system and process information, such as CPU, DMA channel and interrupt usage information. |
/etc | System-related configuration Files, such as boot options, etc. |
/bin | Most of them are necessary commands and can be used by ordinary users |
/dev | The directory where various device files are located, such as CDs, U disks, hard disks, etc. |
/tmp | Generated during the running of the program Temporary files |
/boot | Files to be used by the boot loader, the kernel image is usually saved in this directory |
/mnt | is the mounting directory of the temporary file system, such as U disk, CD, etc. You can establish a mount point in this directory |
Classification of Linux file systems
Files are a collection of related information with names. There are many ways to classify them. They are divided into four categories under the Linux system .
Ordinary files are also called regular files and contain strings of various lengths. Common files include the following types.
(1) Text file
(2) Data file
(3) Executable binary file
You can use the file command to view the file type. The command can take any number of file names as parameters, separated by spaces. The usage method is:
file filenamel [filename2 … ]
The main purpose is to manage and organize a large number of files in the system. It stores the location, size and other file-related information of a set of related files. Directory files are generally referred to as directories, including file names, subdirectory names and pointers. It is the only place where Linux stores file names, and directory files can be listed using the ls command.
ˆ those directory entries that point to the same index node. When viewed using the ls command, the sign of the linked file starts with the letter l, and "->" after the file points to the linked file.
The Linux system treats each I/O device as a file. Device files can be subdivided into block device files and character device files. The access of the former is based on character blocks, while the latter is based on single character. Some Linux devices such as disks, terminals, printers, etc. are represented in the form of files. Such files are device files and are often placed in the /dev directory.
File naming rules
(1) The file name should be as single as possible.
(2) Except for '/' and null characters, the file name can contain any ASCII characters, because these two characters are treated as path and special characters by the system kernel.
(3) It is customary to use underscores and dots to distinguish file types and make file names more readable. However, the following characters should be avoided because they have special meanings for the system shell. These characters include; |〈〉, $,! ,%,&,*,? ,\,(),[]wait. ,
(4) File names should avoid using spaces, tabs or other control characters.
(5) In order to facilitate management and identification, similar files should use the same suffix or extension.
(6) The system distinguishes the case of file names. File and directory names created by general users should use lowercase characters.
(7) File names starting with a dot are hidden files. By default, they cannot be displayed on the screen using the ls command. Also, by default, Shell wildcards do not match such hidden file names.
File name wildcards
In order to process multiple files at one time, Shell provides several special characters, called file wildcards. The main ones are The following types.
(1) Asterisk "*": matches 0 or more any characters, and can match all files in the current directory, except hidden files starting with a dot.
(2) Question mark "?": Matches only one arbitrary character. Multiple question marks can be used. For example file? Can match file1, file2, file3 files, but does not match file, file10.
(3) Square brackets "[ ]": only matches one of the characters in the square brackets. You can use a dash to represent a range of characters. If the square brackets start with an exclamation point, it means it does not match. Matches characters after the exclamation point.
Permissions of users in the Linux system
Every file and directory in the Linux system has access permissions, which are used to determine what How users can access and operate the file or directory. The Linux system stipulates three different types of users based on the user's identity and login method: the file owner user (user), the same group of users (group), and other users who can access the system (others). It also stipulates that each user has three ways to access files or directories: readable files (r), writable files (w), and executable files (x).
In addition, the attributes of a Linux file or directory mainly include: the node, type, number of links, the user and user group it belongs to, the most recent access or modification time, etc. Users can view it through the ls command (the -lih option needs to be used to display complete information)
Function of file and directory permissions
Read permission (r) means that only the specified user is allowed to read the contents of the corresponding file and is prohibited from making any changes to it; for example, the directory read permission means that the files stored in the directory can be listed, that is, read Directory contents.
Write permission (w) means that the specified user is allowed to open and modify the file; for example, directory write means that it allows you to delete or create new files or directories from the directory.
Execution permission (x) means that the specified user is allowed to execute the file as a program; if the directory is executable, it means that you are allowed to search in the directory and use the cd command to switch the working directory to the directory.
When the Linux system creates a file, it will automatically assign the read and write permissions of the file to its owner, so that the owner can display and modify the file, and can also change these permissions to other combinations.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of What is the structure of linux file system. For more information, please follow other related articles on the PHP Chinese website!

The five core components of the Linux operating system are: 1. Kernel, 2. System libraries, 3. System tools, 4. System services, 5. File system. These components work together to ensure the stable and efficient operation of the system, and together form a powerful and flexible operating system.

The five core elements of Linux are: 1. Kernel, 2. Command line interface, 3. File system, 4. Package management, 5. Community and open source. Together, these elements define the nature and functionality of Linux.

Linux user management and security can be achieved through the following steps: 1. Create users and groups, using commands such as sudouseradd-m-gdevelopers-s/bin/bashjohn. 2. Bulkly create users and set password policies, using the for loop and chpasswd commands. 3. Check and fix common errors, home directory and shell settings. 4. Implement best practices such as strong cryptographic policies, regular audits and the principle of minimum authority. 5. Optimize performance, use sudo and adjust PAM module configuration. Through these methods, users can be effectively managed and system security can be improved.

The core operations of Linux file system and process management include file system management and process control. 1) File system operations include creating, deleting, copying and moving files or directories, using commands such as mkdir, rmdir, cp and mv. 2) Process management involves starting, monitoring and killing processes, using commands such as ./my_script.sh&, top and kill.

Shell scripts are powerful tools for automated execution of commands in Linux systems. 1) The shell script executes commands line by line through the interpreter to process variable substitution and conditional judgment. 2) The basic usage includes backup operations, such as using the tar command to back up the directory. 3) Advanced usage involves the use of functions and case statements to manage services. 4) Debugging skills include using set-x to enable debugging mode and set-e to exit when the command fails. 5) Performance optimization is recommended to avoid subshells, use arrays and optimization loops.

Linux is a Unix-based multi-user, multi-tasking operating system that emphasizes simplicity, modularity and openness. Its core functions include: file system: organized in a tree structure, supports multiple file systems such as ext4, XFS, Btrfs, and use df-T to view file system types. Process management: View the process through the ps command, manage the process using PID, involving priority settings and signal processing. Network configuration: Flexible setting of IP addresses and managing network services, and use sudoipaddradd to configure IP. These features are applied in real-life operations through basic commands and advanced script automation, improving efficiency and reducing errors.

The methods to enter Linux maintenance mode include: 1. Edit the GRUB configuration file, add "single" or "1" parameters and update the GRUB configuration; 2. Edit the startup parameters in the GRUB menu, add "single" or "1". Exit maintenance mode only requires restarting the system. With these steps, you can quickly enter maintenance mode when needed and exit safely, ensuring system stability and security.

The core components of Linux include kernel, shell, file system, process management and memory management. 1) Kernel management system resources, 2) shell provides user interaction interface, 3) file system supports multiple formats, 4) Process management is implemented through system calls such as fork, and 5) memory management uses virtual memory technology.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
