File types for Linux

Source: Internet
Author: User

when introducing properties, it is mentioned that the first flag (d or-) can represent a directory or a file, which is a different file type. There are several types of Linux files:? Ordinary files (regular file): The file that is generally accessed by the Ls-al, the first attribute in the attribute shown by the property is [-], for example [-rwxrwxrwx]. In addition, according to the contents of the document, it can be broadly divided into:

?  Plain text file (ASCII): This is the most file type in a UNIX system and is called a plain text file because the content is data that we can read directly, such as numbers, letters, and so on. The settings file is almost all of this file type. For example, using the command "Cat ~/.BASHRC" You can see the contents of the file (cat reads the contents of the file).

?  Binary (binary): As we mentioned in the GNU history, the system only knows and can execute binaries (binary file). Executable files in Linux (scripts, batch files in text mode, not counted) are in this format. For example, the command cat is a binary file.

?  Data format files: Some programs will read files in certain formats while they are running, and those files in a particular format can be called data files. For example, when a user logs on, Linux logs the login data in the/var/log/wtmp file, which is a data file that can be read by the last command. However, when using cat, garbled characters are read. Because it is a file that belongs to a special format.

directory: Is the directory, the first property is [d], for example [drwxrwxrwx].

? Connection file: A shortcut similar to Windows. The first property is [l], for example [lrwxrwxrwx].

? Device and Device files: Some files related to system peripherals and storage are usually concentrated in the/dev directory. It is usually divided into two types:
block device file: an interface device that stores data for system access, in simple terms a hard disk. For example, the code for a hard drive is a file such as/dev/hda1. The first property is [b].

?  Character (character) device file: An interface device for a serial port, such as a keyboard, mouse, and so on. The first property is [C].

socket (Sockets): This type of file is commonly used in network data connections. We can start a program to listen to the client's requirements, and the client can communicate through the socket. The first property is [s], which is most commonly seen in the/var/run directory.

?  Pipeline (FIFO, pipe): FIFO is also a special type of file, its main purpose is to solve multiple programs to access a file at the same time caused by errors. FIFO is the abbreviation for first-in-first-out (first-in, FIFO). The first property 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.

In addition to the device files are very important in the system files, it is best not to modify the outside (usually it will not let you modify), another interesting file is the connection file. If you often put your application on the desktop, you should know that there are so-called "shortcuts" under Windows. Similarly, you can simply treat a connection file under Linux as a shortcut to a file or directory. Sockets and piping files are difficult to understand because they are closely related to the process, and then come back to see the process (Chapter 17th) in the future. In addition, the system description can be viewed through the man FIFO and man socket.

File types for Linux

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.