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

How to use the file command

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article is a detailed introduction to "how to use the file command". The content is detailed, the steps are clear, and the details are properly handled. I hope this article "how to use the file command" can help you solve your doubts. Let's go deeper and learn new knowledge together with the ideas of the small editor.

The file command detects the type of a given file. File command to check the file is divided into file system, magic number check and language check three processes.

profile

The official interpretation of file is:

file - determine file type

That is to say, it can identify the meaning of file type, and can also be used to identify the encoding format of some files.

examples

Here are a few examples of comparative use.

Example 1: Default

file and then directly follow the file to get the information shown below

file book.pdfdelete.pdf: PDF document, version 1.3file bookdelete: PDF document, version 1.3

It can be seen that adding suffixes or not is irrelevant.

Example 2: Do not display the name file-b book.pdfPDF document, version 1.3

Add-b parameter, is the meaning of brief, will only display the file identification results, do not display the file name, this is actually for many files, not very friendly.

Example 3: Output easy-to-understand information file -i delete.pdfdelete.pdf: application/pdf; charset=binary

I don't know what that means, but I can easily read the file type I want to know. That's enough, isn't it, since we're here with the file command.

Example 4: View file information of file name in file cat hello.txtsunset.jpg file-f hello.txtsunset.jpg: JPEG image data, JFIF standard 1.01

This sounds so awkward, in fact, it is very simple, in fact, it is not difficult, plus the-f parameter, is the meaning of file-from type, in the end is a few meanings, that is, you want to view the file type information of the file name in a file, from this file to read the information from the file, as follows.

Example 5: good-looking chicken ribs file -F === "sunset.jpg sunset.jpg == JPEG image data, JFIF standard 1.01

This function to tell the truth, did not understand what the role, default: feel good to use, of course, this should belong to the custom type, as shown below:

Example 6: View soft link file information file a.jpg a.jpg: symbolic link to `sunset.jpg'file -L a.jpg a.jpg: JPEG image data, JFIF standard 1.01

By default, if there is no L parameter, you can only get the information that this file is a soft link. If you add this parameter, you can see the file information of the source file. This function is still very good.

Read here, this "file command how to use" article has been introduced, want to master the knowledge points of this article also need to practice to understand, if you want to know more related content of the article, welcome to pay attention to 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

Development

Wechat

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

12
Report