linux file命令詳解 linux file命令怎麼使用

來源:互聯網
上載者:User

Linux file命令用於辨識檔案類型。

通過file指令,我們得以辨識該檔案的類型。

文法

file[-beLvz][-f<名稱檔案>][-m<魔法數字檔案>...][檔案或目錄...]

參數:

  • -b  列出辨識結果時,不顯示檔案名稱。

  • -c  詳細顯示指令執行過程,便於排錯或剖析器執行的情形。

  • -f

    <名稱檔案>  指定名稱檔案,其內容有一個或多個檔案名稱呢感,讓file依序辨識這些檔案,格式為每列一個檔案名稱。
  • -L  直接顯示符號串連所指向的檔案的類別。

  • -m

    <魔法數字檔案>  指定魔法數字檔案。
  • -v  顯示版本資訊。

  • -z  嘗試去解讀壓縮檔的內容。

  • [檔案或目錄...] 要確定類型的檔案清單,多個檔案之間使用空格分開,可以使用shell萬用字元匹配多個檔案。

執行個體

顯示檔案類型:

[root@localhost~]#file install.log install.log:UTF-8Unicodetext[root@localhost~]#file-b install.log<==不顯示檔案名稱UTF-8Unicodetext[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

顯示符號連結的檔案類型

[root@localhost~]#ls-l/var/mail lrwxrwxrwx1root root1008-1300: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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.