Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction of file types in linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you an introduction about the file types in linux. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

1. Everything in Linux is saved and managed in the form of a file, that is, everything is a file.

An ordinary file is a file.

Directories (called folders under win) are files.

Hardware devices (keyboards, hard drives, printers) are files.

Resources such as sockets (socket) and network communications are also files.

2. File type:

1) ordinary files

Files that can be used directly, such as mp4, jgp and html, belong to ordinary files.

2) Catalog files

For users accustomed to win systems, directories are files that may not be acceptable.

In Linux systems, directory files contain the file names of each file in this directory and pointers to those files. Opening a directory is equivalent to opening a directory file.

That is, as long as you have permission, you can access any file in the directory at will.

Vim directory name

3) character device files and block device files

It is usually hidden in the / dev/ directory and is only used when reading devices or interacting with peripherals.

For example, the disk drive belongs to the block device file, and the serial device belongs to the character device file.

4) socket file (socket)

Socket files are generally hidden in the / var/run/ directory for network communication between processes.

5) symbolic link file (symbolic link)

Similar to the shortcut in win, it refers to a pointer to another file (soft link).

6) Pipeline file (pipe)

It is mainly used for interprocess communication.

For example, use the mkfifo command to create a FIFO file while enabling process A to read data from the FIFO file and process B to write data from the FIFO file and read as you write.

3. The pros and cons of all documents:

Different from Windows system, Linux system does not have as many drive letters as C disk, D disk and E disk, but has only one root directory (/). All files (resources) are stored in the tree structure with the root directory (/) as the tree root.

(1) the most obvious advantage of this is that developers only need to use a set of API and development tools to access most of the resources in the Linux system. Lift

As a simple example, almost all read (read file, read system status, read socket, read PIPE) in Linux can be done with read function; almost all changes (change file, change system parameters, write socket, write PIPE) can be done with write function.

(2) the disadvantage is that the use of any hardware device must be mounted with a directory under the root directory, otherwise it cannot be used. We know that the Linux itself has a file directory structure with the root directory as the root of the tree, and the same is true of each device, which is independent of each other. If we want to find the directory structure of the device files through the root directory on Linux, we must merge the two file system directories into one, which is what mounting really means.

The above is the introduction of the file types in the linux shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report