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

Use the file command of linux to identify file types

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Editor to share with you the use of linux's file command to identify file types, I hope you have learned a lot after reading this article, let's discuss it together!

The file command is used to identify file types and can also be used to identify the encoding format of some files. It gets the file type by looking at the header information of the file, rather than determining the file type by extension, as Windows does.

Syntax format: file [parameters] [file]

Common parameters:

When the identification results are listed, the file name (brief mode) is not displayed.-c shows the instruction execution process in detail to facilitate troubleshooting or analyze the execution of the program.

Often used with-m to debug the magic number file before installing it-f specified name files, which have one or more file names, let file identify the files in order, in the format of one file name per column-L directly displays the file category pointed to by the symbolic link-m specifies the magical digital file-v display version information-z attempts to interpret the contents of the compressed file-I display the MIME category

Reference example:

Displays the file type:

[root@linuxcool ~] # file install.log

Install.log: UTF-8 Unicode text

Displays the file type, not the file name:

[root@linuxcool] # file-b install.log

UTF-8 Unicode text

Displays the file type, the MIME category, and does not show the file name:

[root@linuxcool] # file-b-I install.log

Text/plain; charset=utf-8

Displays the file type of the symbolic link:

[root@linuxcool ~] # ls-l / var/mail

Lrwxrwxrwx 1 root root 10 08-13 00:11 / var/mail-> spool/mail

[root@linuxcool ~] # file / var/mail

/ var/mail: symbolic link to `spool/mail'

Displays the file category that the symbolic link points to:

[root@linuxcool] # file-L / var/mail

/ var/mail: directory has finished reading this article. I believe you have some understanding of using linux's file command to identify file types. If you want to know more about it, welcome to follow the industry information channel. Thank you for reading!

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