Linux file command


  Translation results:

file

UK[faɪl] US[faɪl]

vt. To file (divorce proceedings or other lawsuits); to file...; to file; to file; Release, send to the newspaper

vi. Send (report to the newspaper); walk in a line; make an application

n. File; file (folder); column; file

Third person singular: files Plural: files Present participle: filing Past tense: filed Past participle: filed

Linux file commandsyntax

Function: The file command is used to identify file types. Through the file command, we can identify the type of the file.

Syntax: file [-bcLvz][-f <name file>][-m <magic number file>...][file or directory... ]

Linux file commandexample

Display 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 type

[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

Popular Recommendations

Home

Videos

Q&A