Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux's method of judging whether it is a file or not

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you the method of judging whether linux is a document or not. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

The suffix name of the file under linux is only to distinguish the file type, which is different from that under windows. For example, the text type Linux can be named text.exe, while under windows, it will be executed as a program and report an error.

So how to judge whether something under linux is a file? in fact, on linux, everything is a file, the key is to distinguish what type of file they are.

Ls-l command

The properties of the display file are usually displayed in the following form:

Drwxr-xr-x file attribute file type-regular file, that is, filed directory file bblock device is block device file, such as hard disk; supports random access to ccharacter device or character device file in units of block, such as keyboard support linear access to lsymbolic link in units of character, namely symbolic link file, also known as soft link file ppipe, named pipe file ssocket, that is, socket file, used to enable two processes to communicate

Regular file

For regular files, they can be divided into binary files, xml files, db files and so on. If you want to view the type of a regular file, you can use the file command

Device class file

Normally, column 5 after using ls-l will show the current file size, but in the device class file there will be two numbers separated by commas, which does not mean the size.

-the first number: the main device number, which is used to distinguish the type of device. The main device number of different devices is different, and the device number of the same device is the same, which is used to determine the driver of the loaded device.

-second number: secondary device number, which is used to distinguish different devices of the same type of device, such as hard disk 1, hard disk 2, etc.

The above is the editor for you to share the linux to determine whether it is a document, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report