Linux File Type

Source: Internet
Author: User

Linux File Type
When introducing attributes, we mentioned that the front mark (d or-) can represent directories or files, that is, different file types. In Linux, there are mainly the following types of files: • regular file: the files we normally access, in the properties displayed by ls-al, the first attribute is [-], for example, [-rwxrwxrwx]. In addition, according to the file content, it can be roughly divided:

• Plain text files (ASCII): This is the most common file type in Unix systems. It is called plain text files because the content is the data that we can directly read, such as numbers and letters. Almost all configuration files belong to this file type. For example, run the "cat ~" command ~ /. Bashrc "to see the content of the file (cat reads the file content ).

• Binary: we mentioned in the history of GNU development that the system only recognizes and can execute binary files ). This format is used for executable files in Linux (script or text-based batch files are not counted. For example, the command cat is a binary file.

• Data Files in data Format: Some programs read certain files in specific formats during running. These files can be called data files ). For example, when a user logs on to Linux, the logon data is recorded in the/var/log/wtmp file, which is a data file that can be read by the last command. But when cat is used, garbled characters are read. Because it belongs to a special format file.

• Directory: directory. The first attribute is [d], for example, [drwxrwxrwx].

• Link: similar to shortcuts in Windows. The first attribute is [l], for example, [lrwxrwxrwx].

• Device and device Files: files related to system peripherals and storage are usually concentrated in the/dev directory. There are two types:
Block Device Files: an interface device that stores data for system access. In short, it is a hard disk. For example, the Code of Hard Disk 1 is/dev/hda1 and other files. The first attribute is [B].

• Character (character) Device File: it is the interface device of the serial port, such as the keyboard and mouse. The first attribute is [c].

• Sockets (sockets): these types of files are usually used for network data connections. We can start a program to listen to the requirements of the client, the client can communicate through the socket. The first attribute is [s], which is most often seen in the/var/run directory.

• Pipelines (pipe): FIFO is also a special file type. It aims to solve errors caused by simultaneous access to a file by multiple programs. FIFO is the abbreviation of first-in-first-out. The first attribute is [p].

Then, using the "ls-al" command, you can simply determine the type of the file by judging the first attribute of each file.

Except that the device file is a very important file in the system, it is best not to modify it at will (usually it won't let you modify it). Another interesting file is the connection file. If applications are often placed on the desktop, you should know that there is a "shortcut" under Windows ". Similarly, Connection Files in Linux can be considered as shortcuts to files or directories. Sockets and MPs queue files are hard to understand, because they are closely related to processes. After learning about the processes (Chapter 1) in the future, come back and check them. In addition, you can view the system instructions through man fifo and man socket.

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.