Knowledge about Linux file types and extensions

  

We all know that there are many types of system files. If you don't know the file type, you can't know the specific role of some files. What are the file types of Linux systems? What? The following small series will give you a detailed introduction to the Linux system file type and extension knowledge.

significance file name and file type Linux Linux files are represented by two different concepts. We create files such as file.txt and file.tar.gz through general applications. Although these files are opened with different programs, they are mostly regular files (also known as ordinary files). file).

First, the file type

Linux file types are common: ordinary files, directory files, character device files and block device files, symbolic link files, etc. (see System Home Linux for details) The file command identifies the file type method. Now let's take a brief description.

1. Ordinary files

We use ls -lh to view the properties of a file, you can see that there is something like -rwxrwxrwx, it is worth noting that the first symbol is -, such Files are ordinary files in Linux. These files are typically created with related applications such as image tools, document tools, and archive tools. . . . . . . Or cp tools, etc. The way to delete such files is with the rm command. In addition, according to the contents of the document, it can be roughly divided into:

1》. Plain text file (ASCII):

This is the most common type of file in Linux systems, called plain text file because the content is data that we humans can directly read, such as numbers, letters, and so on. Almost as long as the files we can use as settings are all of this file type. For example, you can use the command: cat ~/.bashrc to see the contents of the file. (cat is an instruction to read out the contents of a file).

2". Binary:

Linux systems only know and can execute binary files. Executable files (scripts, text-based batch files are not counted) in Linux are files in this format. The command cat just used is a binary file.

3". Data format file (data):

Some programs read certain files in a specific format during operation. Those files in a specific format can be called data files. For example, when our user logs in, the log data will be recorded in the /var/log/wtmp file. The file is a data file, which can be read by the last command! But when using cat, it will read garbled ~ because he is a file of a special format?

2. Directory file

When we execute in a directory, we can see that there is something like drwxr-xr-x. This file is the directory. The directory is a special file in Linux. . Note that its first character is d. The command to create a directory can use the mkdir command, or the cp command, to copy a directory to another directory. Remove the command with rm or rmdir.

3. Character device or block device file

If you enter the /dev directory and list the files, you will see something like this:

The code is as follows:

[root@localhost ~]# ls -al /dev/tty"/p" "p"crw-rw-rw- 1 root tty 5, 0 11-03 15:11 /dev/tty"/p "p"[root@localhost~]# ls -la /dev/sda1"/p" "p"brw-r----- 1 root disk 8, 1 11-03 07:11 /dev/sda1< Br>

We see that the attribute of /dev/tty is crw-rw-rw- , note that the first character before is c, which means a character device file. Such as cats and other serial devices. We see that the attribute of /dev/sda1 is brw-r-----. Note that the first character in front is b, which means block devices, such as hard disks, optical drives, etc.

This kind of file is created with mknode and deleted with rm. Currently in the latest Linux distributions, we generally do not have to create device files ourselves. Because these files are associated with the kernel.

Some files related to system peripherals and storage, etc., are usually concentrated under the /dev directory! Usually divided into two types:

Block device file file:
Previous12Next page Total 2 pages

Copyright © Windows knowledge All Rights Reserved