描述:查看某個文件的基本信息ui
用法:file [option] 文件名3d
經常使用參數:code
-f:查看文件中的文件名的文件類型ip
-z:嘗試去解讀壓縮文件的內容it
-L:查看軟鏈接對應的文件類型io
示例:1.使用file命令查看/bin/ls的文件信息table
[root@share19 ~]# file /bin/ls /bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0xec333a104e045327c5e3d0ca6dda16c610a210f3, stripped
2.嘗試去解讀壓縮文件的內容ast
[root@DB-Server ~]# file -z Temp.txt.gz Temp.txt.gz: UTF-8 Unicode text, with very long lines, with CRLF line terminators (gzip compressed data, was "Temp.txt", from Unix, last modified: Tue Jun 24 00:34:15 2014)
3.查看軟鏈接對應的文件類型sed
[root@DB-Server ~]# ln -s Temp.txt.gz sfile [root@DB-Server ~]# file sfile sfile: symbolic link to `Temp.txt.gz' [root@DB-Server ~]# file -L sfile sfile: gzip compressed data, was "Temp.txt", from Unix, last modified: Tue Jun 24 00:34:15 2014