file [OPTION...] [FILE...]
Determine type of FILEs. 显示文件的类型
-
常用选项
-b:do not prepend filenames to output lines 不输出文件名 -f:read the filenames to be examined from FILE 按文件清单依次分析 -L:follow symlinks (default) 查看链接指向的源文件类型.默认是查看链接属性 -i:output MIME type strings (--mime-type and --mime-encoding) 显示mime类型 text/plain:普通文本。 text/html:HTML文本。 application/pdf:PDF文档。 application/msword:Word文档。 image/png:PNG图片。 mage/jpeg:JPEG图片。 application/x-tar:TAR文件。 application/x-gzip:GZIP文件
-
查看文件类型,程序文件显示版本等信息
[xzt7566@centos7-test Downloads]$ file -bi /etc/hosts 显示详细编码类型 text/plain; charset=us-ascii [xzt7566@centos7-test Downloads]$ file /bin/bash /bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=9223530b1aa05d3dbea7e72738b28b1e9d82fbad, stripped