? ? Everything in Linux is a file, but the files have to be typed. So how do you see what type of file it is? You can use the following commands in Linux
ls -l path
? ? The properties of the displayed file are usually displayed in the following form:
drwxr-xr-x
- 1th Letter: Representing the file type
- 2nd to 4th Letter: permissions on behalf of the user
- 5th to 7th letter: permissions on behalf of the user group
- 8th to 10th Letter: permissions on behalf of other users
? ? There are 7 types of files commonly found in Linux, as follows:
file Properties |
File Type |
- |
Regular files, which are file |
D |
Catalog files |
B |
Block device files, such as hard disks, that allow random access in block units |
C |
Character device, which is a character unit file, such as keyboard support for linear access in character |
L |
Symbolic link is a symlink file, also known as a soft link file |
P |
Pipe is named piping file |
S |
Socket is a socket file that enables two processes to communicate |
对于常规文件而言,又可以分为二进制文件,xml文件,db文件等等,如果要查看一个常规文件的类型可以使用 file 命令
通常情况下,在使用ls -l 后的第5列会显示当前文件的大小,但在设备类文件会有两个数字,以逗号间隔,这个并不表示是大小。 - 第一个数字:主设备号,用于区分设备类型,不同的设备主设备号不同,同一设备的设备号相同,用于确定加载设备的驱动程序 - 第二个数字:次设备号,用于区分同一种类型设备的不同设备,如硬盘1,硬盘2等
Examples are as follows:
Linux File types detailed