Linux file types

Source: Internet
Author: User

First, Linux How are file types differentiated?

When it comes to documents, you have to get a quick look at the inode.
Inode: An index node that is used to store basic information about a file.
The inode is a data structure in the Unix/linux operating system, essentially a struct that defines variables that record information related to the file. A large number of inode is created when the operating system creates the file system.
Inode This structure contains the following information:
1. Inode number
2. Used to identify file types and mode information for stat C functions
3, the number of links to the file
4, the owner of the UID
5, the owner of the group ID (GID)
6, the size of the file
7. The actual number of disk blocks used by the file.
8. Time of Last modification
9. Time of last visit
10. Time of last change
As you can see, the inode contains all the information about the file, in addition to the file name and the contents, so the file name does not have much effect under Linux. In general, we operate on a file by looking for the inode that the file is connected to, and then manipulating the file with the inode number, but we cannot get the file name when we know the inode number.

Second, Linux the file type under

1. Plain Text:( regular file) begins with "-" .

You can see the above file attributes, all beginning with "-", this "-" means that it is a normal file.

The normal text below Linux also includes three kinds:
1.1. Plain Text Documents:
This is the largest type of file in Linux, known as a plain text document, where we can read data directly.

1.2. binary files:
The executable file in Linux is in this format.

1.3. Data format file:
Some programs will read files in certain formats while they are running, which are known as data files, and using cat to see them is garbled because it belongs to a specially formatted file.

2 , directory: (directory) in "D" start.

Everything under Linux is in the form of a file, so the directory belongs to the catalog file.

You can see that the properties of these files begin with "D", which means that it is a directory file.

3 , Connection file: (link) in "L" the file that starts with

You can see that the properties of these files begin with "L" to indicate that they are linked files.

4 , equipment and equipment files:

The device file is divided into a block device file with a volume character device file. We go into the/dev directory and look at a lot of these files.
Character device files: Files that start with "C" are the interface files for some serial ports, such as keyboards, mice, and so on.

You can see that the properties of these files begin with "C" indicating that they are character device files.

Block device files: Files that start with "B" are some storage files, such as hard disks, floppy disks, and so on.

You can see that the properties of these files begin with "B" to indicate that they are block device files.

5 , Sockets: (sockets) in "S" the beginning of the file.

Socket files are also known as data interface files, and this type of file is typically used for data connections on the network. We can start a program to listen to the client's request, and the client can communicate through the data interface file.

You can see that the properties of this file begin with "s" indicating that they are socket files.

6 , Piping: (fifo,pipe) in "P" the beginning of the file.

A pipeline file is also a special type of file that is called a data transfer file, and its main purpose is to solve the error problems caused by multiple programs accessing a file at the same time. The workaround is FIFO.
The properties of a pipeline file begin with "P".

Linux file types

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.