English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Linux file command is used to identify file types.
Through the file command, we can identify the type of the file.
file [-bcLvz][-f <Name File>][-m <Magic Number File>...][File or Directory...]
Parameters:
Display File Type:
[root@localhost ~]# file install.log install.log: UTF-8 Unicode text [root@localhost ~]# file -b install.log <== Do not display file name UTF-8 Unicode text [root@localhost ~]# file -i install.log <== Display MIME category. 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