Linux basic commands -file

file command to detect a given file type. file command to check the file into the file system, magic magic number checking and language examination 3 process.

grammar

File (option) (parameters)
Options
- B: when it lists recognition result, the file name is not displayed;
 - C: instruction execution is shown in detail, or to facilitate debugging scenario analysis program executed;
 -f <file name> : Specifies the name of the file, the contents of which have one or more when a file name, file sequentially so that the identification of these files, a file format for each column name;
 - L: direct display file categories symbolic link is pointing;
 -m <file magic number> : Specifies the magic of digital files;
 - v: displays version information;
 the -z: try to interpret the contents of compressed files.

parameter

File: To determine the list of file types, use spaces to separate between multiple files, you can use shell wildcards to match multiple files.

Examples

Show file type

[root@localhost ~]# file install.log
install.log: UTF-8 Unicode text

[root@localhost ~]# file -b install.log      <== 不显示文件名称
UTF-8 Unicode text

[root@localhost ~]# file -i install.log      <== 显示MIME类别。
install.log: text/plain; charset=utf-8

[root@localhost ~]# file -b -i install.log
text/plain; charset=utf-8

Display symbolic link file types

[root@localhost ~]# ls -l /var/mail
lrwxrwxrwx 1 root root 10 08-13 00:11 /var/mail -> spool/mail

[root@localhost ~]# file /var/mail
/var/mail: symbolic link to `spool/mail'

[root@localhost ~]# file -L /var/mail
/var/mail: directory

[root@localhost ~]# file /var/spool/mail
/var/spool/mail: directory

[root@localhost ~]# file -L /var/spool/mail
/var/spool/mail: directory

 

Guess you like

Origin www.cnblogs.com/lj7xun/p/10983653.html