婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > 一天一個shell命令 linux文本系列-file命令用法

一天一個shell命令 linux文本系列-file命令用法

熱門標簽:德陽400電話申請 商機地圖標注 天津電話外呼系統排名 智能電銷機器人有用嗎 測繪地圖標注名稱 鶴崗400電話申請 外呼電話系統怎么操作 怎么在百度地圖標注公司的位置 百度地圖標注直線距離

linux file 命令簡介:

該命令用來識別文件類型,也可用來辨別一些文件的編碼格式。它是通過查看文件的頭部信息來獲取文件類型,而不是像Windows通過擴展名來確定文件類型的。

更多介紹可以查看這篇文章:https://www.jb51.net/LINUXjishu/388984.html

file 官方解釋:Determine type of FILEs. 判定文件的類型。

小知識:在UNIX/Linux系統中,文件類型并不是由擴展名決定的(Windows是的)。

開篇例子:

1. $file file.txt

輸出:file.txt: ASCII English text

注:file.txt是我用file –help gt; file.txt生成的幫助文檔

查看—help

復制代碼 代碼如下:

Usage: file [OPTION...] [FILE...]
 Determine type of FILEs.
--help   display this help and exit
-v, --version   output version information and exit
 -m, --magic-file  LIST  use LIST as a colon-separated list of magic
 number files
-z, --uncompress   try to look inside compressed files
-b, --brief    do not prepend filenames to output lines
 -c, --checking-printout   print the parsed form of the magic file, use in
conjunction with -m to debug a new magic file before installing it
 -e, --exclude TEST   exclude TEST from the list of test to be performed for file. Valid tests are: ascii, apptype, compress, elf, soft, tar, tokens, troff
 -f, --files-from FILE   read the filenames to be examined from FILE
-F, --separator STRING   use string as separator instead of `:'
-i, --mime  output MIME type strings (--mime-type and
 --mime-encoding)
--apple  output the Apple CREATOR/TYPE
 --mime-type  output the MIME type
--mime-encoding  output the MIME encoding
 -k, --keep-going  don't stop at the first match
 -l, --list  list magic strength
 -L, --dereference  follow symlinks (default)
-h, --no-dereference  don't follow symlinks
 -n, --no-buffer  do not buffer output
 -N, --no-pad  do not pad output
 -0, --print0  terminate filenames with ASCII NUL
-p, --preserve-date  preserve access times on files
-r, --raw  don't translate unprintable chars to \ooo
-s, --special-files  treat special (block/char devices) files as ordinary ones
 -C, --compile  compile file specified by -m
 -d, --debug  print debugging messages

解讀:

1. -z

查看壓縮文件內的信息

2. -b, -e, -i, –r

-b 去掉輸出行的前綴命名
-e 從測試列表到被執行文件排除測試。有效的測試包括:ascii, apptype, compress, elf, soft, tar,
-i 打印MIME
-R 不轉譯無法打印的字符為\ooo

3. magic file

以mgc為擴展名的文件,Microsoft office媒體目錄文件

實戰實例:

1. $file -z file.zip
查看file.zip包中的文件信息

2. $file –i file.txt
out:file.txt: text/plain; charset=us-ascii

打印MIME類型
 
$file file.txt
out:file.txt: ASCII English text

3. magic file

我翻譯起來實在蹩腳。。 只能猜測查看$which file 看看,沒有收獲。最終通過$file得到

Usage: file  [-bchikLlNnprsvz0] [--apple] [--mime-encoding] [--mime-type]
       [-e testname] [-F separator] [-f namefile] [-m magicfiles] file ...
 file  -C [-m magicfiles]
 file  [--help]

然后嘗試file –C 得到magic.mgc文件。。。 不知有何用,慚愧

Usage: file [OPTION...] [FILE...]
Determine type of FILEs.

      --help                 display this help and exit
  -v, --version              output version information and exit
  -m, --magic-file LIST       以冒號分割的魔法數字清單作為列表
                           
  -z, --uncompress           查看壓縮文件內容
  -b, --brief                不前綴文件名到輸出行里
  -c, --checking-printout    打印魔法文件的解析格式,安裝前,用-m debug一個新的魔法文件
                             
  -e, --exclude TEST         排除測試從測試列表到執行文件。有效的測試:ascii, apptype, compress, elf, soft, tar, tokens, troff
  -f, --files-from FILE      從已查的文檔中讀取文件名
  -F, --separator STRING     用String作為分隔器 代替 “:”
  -i, --mime                 輸出MIME類型的字符串 (--mime-type and
                               --mime-encoding)
         
      --apple                輸出蘋果類型 CREATOR/TYPE
      --mime-type            打印MIME類型
      --mime-encoding        打印 MIME 編碼
  -k, --keep-going           不停留在第一個匹配
  -l, --list                 列出magic深度
  -L, --dereference          跟隨符號鏈接(缺省)
  -h, --no-dereference       不跟隨符號鏈接
  -n, --no-buffer            不緩沖輸出
  -N, --no-pad               不打印輸出
  -0, --print0               NUL終止文件
  -p, --preserve-date        保持文件上的原訪問時間
  -r, --raw                  不轉移不可打印的字符到\ooo
  -s, --special-files        把特殊(塊/字符 設備)文件作為普通文件對待
  -C, --compile              編譯用-m指定的文件
  -d, --debug                打印調試信息

Report bugs to http://bugs.gw.com/

您可能感興趣的文章:
  • linux中無make命令的問題(make: *** 沒有指明目標并且找不到 makefile及make命令安裝方法)
  • Linux 中makefile的命令包定義及使用
  • Linux執行可執行文件提示No such file or directory的解決方法
  • Linux下環境變量配置方法小結(.bash_profile和.bashrc的區別)
  • Linux中文件描述符fd與文件指針FILE*互相轉換實例解析
  • Linux makefile 和shell文件相互調用實例詳解
  • Linux file命令的使用

標簽:滁州 百色 自貢 武漢 六盤水 丹東 優質小號 鎮江

巨人網絡通訊聲明:本文標題《一天一個shell命令 linux文本系列-file命令用法》,本文關鍵詞  一天,一個,shell,命令,linux,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《一天一個shell命令 linux文本系列-file命令用法》相關的同類信息!
  • 本頁收集關于一天一個shell命令 linux文本系列-file命令用法的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 长垣县| 玉田县| 南岸区| 淮滨县| 玉溪市| 蒙自县| 乌兰浩特市| 昌都县| 内江市| 平凉市| 神木县| 余江县| 三河市| 漠河县| 东乡族自治县| 顺平县| 太保市| 永新县| 新兴县| 林甸县| 宽甸| 昂仁县| 康马县| 榕江县| 安西县| 车致| 巴林右旗| 寻乌县| 图木舒克市| 峨眉山市| 秦安县| 棋牌| 浮梁县| 阿鲁科尔沁旗| 徐水县| 广宗县| 巩留县| 兴化市| 丰原市| 安平县| 阜平县|