亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

一天一個(gè)shell命令 linux文本系列-file命令用法

 更新時(shí)間:2016年06月05日 15:51:02   投稿:mdxy-dxy  
這篇文章主要介紹了一天一個(gè)shell命令 linux文本系列-file命令用法,需要的朋友可以參考下

linux file 命令簡(jiǎn)介:

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

更多介紹可以查看這篇文章:http://chabaoo.cn/LINUXjishu/388984.html

file 官方解釋?zhuān)篋etermine type of FILEs. 判定文件的類(lèi)型。

小知識(shí):在UNIX/Linux系統(tǒng)中,文件類(lèi)型并不是由擴(kuò)展名決定的(Windows是的)。

開(kāi)篇例子:

1. $file file.txt

輸出:file.txt: ASCII English text

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

查看—help

復(fù)制代碼 代碼如下:

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

查看壓縮文件內(nèi)的信息

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

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

3. magic file

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

實(shí)戰(zhàn)實(shí)例:

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

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

打印MIME類(lèi)型
 
$file file.txt
out:file.txt: ASCII English text

3. magic file

我翻譯起來(lái)實(shí)在蹩腳。。 只能猜測(cè)查看$which file 看看,沒(méi)有收獲。最終通過(guò)$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       以冒號(hào)分割的魔法數(shù)字清單作為列表
                           
  -z, --uncompress           查看壓縮文件內(nèi)容
  -b, --brief                不前綴文件名到輸出行里
  -c, --checking-printout    打印魔法文件的解析格式,安裝前,用-m debug一個(gè)新的魔法文件
                             
  -e, --exclude TEST         排除測(cè)試從測(cè)試列表到執(zhí)行文件。有效的測(cè)試:ascii, apptype, compress, elf, soft, tar, tokens, troff
  -f, --files-from FILE      從已查的文檔中讀取文件名
  -F, --separator STRING     用String作為分隔器 代替 “:”
  -i, --mime                 輸出MIME類(lèi)型的字符串 (--mime-type and
                               --mime-encoding)
         
      --apple                輸出蘋(píng)果類(lèi)型 CREATOR/TYPE
      --mime-type            打印MIME類(lèi)型
      --mime-encoding        打印 MIME 編碼
  -k, --keep-going           不停留在第一個(gè)匹配
  -l, --list                 列出magic深度
  -L, --dereference          跟隨符號(hào)鏈接(缺?。?br />   -h, --no-dereference       不跟隨符號(hào)鏈接
  -n, --no-buffer            不緩沖輸出
  -N, --no-pad               不打印輸出
  -0, --print0               NUL終止文件
  -p, --preserve-date        保持文件上的原訪(fǎng)問(wèn)時(shí)間
  -r, --raw                  不轉(zhuǎn)移不可打印的字符到\ooo
  -s, --special-files        把特殊(塊/字符 設(shè)備)文件作為普通文件對(duì)待
  -C, --compile              編譯用-m指定的文件
  -d, --debug                打印調(diào)試信息

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

相關(guān)文章

最新評(píng)論