In that year, I learned Linux C-file types and attributes step by step.

Source: Internet
Author: User

 

This series of articles written by muge0913, reproduced please note the Source: http://blog.csdn.net/muge0913/article/details/7339671

 

 

A file is a set of related information with a name. in Linux, an accurate definition of a file is a volume stream that does not contain any other structure. In layman's terms, there is no other relationship between characters in a file except that the characters belong to the same file. The relationship between characters in the file is established and interpreted by the application of the file.

Each file has a specific attribute. In Linux, file attributes are complex, including file types and file permissions.

 

1. File Type

Files in Linux can be divided into five different types. They are common files, directory files, link files, device files, and pipeline files. The following describes them in detail.

(1) common files

Common files, also known as regular files, are the most common and commonly used files. It does not contain the structure information of the file system. Files that are commonly exposed, including graphic files, data files, document files, and sound files, are common files. This type of file can be subdivided into two file types based on its internal structure: text files and binary files.

Text Files: text files are represented by characters (usually ASCII code) and stored in the basic structure of behavior information.

Binary: a binary file is represented in the memory format of information. It is usually not directly viewed, but must use the corresponding software.

(2) Directory files

A directory file is a file used to store file names and related information. Is the Basic node of the kernel organization file system. A directory file can contain a directory file or a common file.

Note: in Linux, a directory file is a type of file. However, the Linux directory file is different from the "directory" concept in other operating systems. It is a type of Linux File. Of course, in actual use, you can not distinguish these two statements. Even in the specific description of this book, sometimes the directory files are abbreviated as directories, but pay attention to their differences in concept.

(3) Link file

A linked file is a special file. It is actually a link to a real object. For example, if you want to use files under other directory files in a directory file, you do not need to copy them. Instead, you only need to create a link file in this directory to point to the file to be called. In actual use, they do not feel any difference. Based on different link objects, linked files can be subdivided into hard-link files and symbolic link files.

(4) Device Files

The device file is the most special file in Linux. Because of its existence, the Linux system can easily access external devices. The Linux system provides a standard interface for external devices to treat external devices as special files. Users can access external devices as they access normal files. This allows the Linux system to easily adapt to evolving external devices. In Linux, device files are usually stored in the/dev directory. The device file uses the device's primary device number and secondary device number to specify an external device. The primary device number indicates the device type, and the secondary device number indicates the specific device. For example
The hard disk is the first primary disk, and the device file in the third partition is/dev/hda3. Among them, HD is the primary device number and A3 is the secondary device number. Depending on the data access method, device files can be subdivided into two types: block device files and character device files.

Block Device Files: block Device Files Access Data with fixed length blocks.

Character Device File: The character device file accesses data with a specified character (usually one character.

Most external devices provide two access methods. However, each device has the best access method.

Note: There is an extremely special/dev/null file in the device file. All data stored on this device will no longer exist.

It can be viewed as a delete operation.

(5) MPs queue files

Pipeline files are also very special files. It is mainly used for information transmission between different processes. When two processes need to transmit data or information between them, they can use pipeline files. One process writes the data or information to be transmitted to one end of the pipeline, and the other process obtains the required data or information from the other end of the pipeline. Generally, pipelines are created in the cache. Use FIFO rules to process data. It can be divided into two types: famous Pipeline and unknown pipeline.

2. File Permission

Linux is a typical multi-user system. Different users are in different positions. To protect the security of the system, Linux requires different permissions for different users to access the same file. For a file in a Linux system, its permissions can be divided into three types: Read Permission, write permission, and execution permission. They are represented by R, W, and x respectively. Different users have different read, write, and execution permissions. For a file, it has a specific owner, that is, the user who owns the file. In Linux, users are classified by group. A user belongs to one or more groups. Users other than the file owner can be divided into the same group of users and other users of the file owner. Therefore, Linux
The system sets different file access permissions based on the file owner, file owner, group users, and other users.

Note: The system administrator root user is a very special user who has the highest control over the system. The root user has the permission to read, write, and execute all files in the system.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.