Table of Contents
The structure of the Linux file system
Home Operation and Maintenance Linux Operation and Maintenance What is the structure of linux file system

What is the structure of linux file system

Mar 02, 2023 am 10:08 AM
linux

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.

What is the structure of linux file system

#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.

What is the structure of linux file system

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 .

1. Ordinary files

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 … ]
Copy after login

2. Directory file

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.

3. Symbolic link files

ˆ 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.

4. Device 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)

What is the structure of linux file system

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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

deepseek web version entrance deepseek official website entrance deepseek web version entrance deepseek official website entrance Feb 19, 2025 pm 04:54 PM

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

How to install deepseek How to install deepseek Feb 19, 2025 pm 05:48 PM

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

How to solve the permissions problem encountered when viewing Python version in Linux terminal? How to solve the permissions problem encountered when viewing Python version in Linux terminal? Apr 01, 2025 pm 05:09 PM

Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

BITGet official website installation (2025 beginner's guide) BITGet official website installation (2025 beginner's guide) Feb 21, 2025 pm 08:42 PM

BITGet is a cryptocurrency exchange that provides a variety of trading services including spot trading, contract trading and derivatives. Founded in 2018, the exchange is headquartered in Singapore and is committed to providing users with a safe and reliable trading platform. BITGet offers a variety of trading pairs, including BTC/USDT, ETH/USDT and XRP/USDT. Additionally, the exchange has a reputation for security and liquidity and offers a variety of features such as premium order types, leveraged trading and 24/7 customer support.

Get the gate.io installation package for free Get the gate.io installation package for free Feb 21, 2025 pm 08:21 PM

Gate.io is a popular cryptocurrency exchange that users can use by downloading its installation package and installing it on their devices. The steps to obtain the installation package are as follows: Visit the official website of Gate.io, click "Download", select the corresponding operating system (Windows, Mac or Linux), and download the installation package to your computer. It is recommended to temporarily disable antivirus software or firewall during installation to ensure smooth installation. After completion, the user needs to create a Gate.io account to start using it.

Ouyi okx installation package is directly included Ouyi okx installation package is directly included Feb 21, 2025 pm 08:00 PM

Ouyi OKX, the world's leading digital asset exchange, has now launched an official installation package to provide a safe and convenient trading experience. The OKX installation package of Ouyi does not need to be accessed through a browser. It can directly install independent applications on the device, creating a stable and efficient trading platform for users. The installation process is simple and easy to understand. Users only need to download the latest version of the installation package and follow the prompts to complete the installation step by step.

How to automatically set permissions of unixsocket after system restart? How to automatically set permissions of unixsocket after system restart? Mar 31, 2025 pm 11:54 PM

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Ouyi Exchange Download Official Portal Ouyi Exchange Download Official Portal Feb 21, 2025 pm 07:51 PM

Ouyi, also known as OKX, is a world-leading cryptocurrency trading platform. The article provides a download portal for Ouyi's official installation package, which facilitates users to install Ouyi client on different devices. This installation package supports Windows, Mac, Android and iOS systems. Users can choose the corresponding version to download according to their device type. After the installation is completed, users can register or log in to the Ouyi account, start trading cryptocurrencies and enjoy other services provided by the platform.

See all articles