Archive
如何確定低級文件類型?
file
(1),當針對某些文件時,例如說“Debian 二進制包(格式 2.0)”*.deb
或“OpenDocument 文本”*.odt
。相反,我想有一種方法來確定使用哪種低級存檔類型:例如,對於 Debian 包可能是ar,對於 OpenDocument 文件可能是 ZIP。我怎樣才能確定這一點?
將
7z
16.02或更高版本與l
p7zip 中的 (list) 選項一起使用以下是一些範例輸出:
異端:
7z l test.odt (..) Scanning the drive for archives: 1 file, 20969 bytes (21 KiB) Listing archive: test.odt -- Path = test.odt Type = zip Physical Size = 20969 (..)
債務:
7z l test.deb (..) Scanning the drive for archives: 1 file, 47320946 bytes (46 MiB) Listing archive: test.deb -- Path = test.deb Type = Ar Physical Size = 47320946 SubType = deb ---- Path = data.tar.xz Size = 47310792 Modified = 2017-03-09 00:04:52 Mode = -rw-r--r-- -- Path = data.tar.xz Type = xz Physical Size = 47310792 Method = LZMA2:26 CRC32 Streams = 1 Blocks = 1 (..)
轉:
7z l test.rpm (..) Scanning the drive for archives: 1 file, 80356 bytes (79 KiB) Listing archive: test.rpm -- Path = test.rpm Type = Rpm Physical Size = 80356 Headers Size = 7726 CPU = x86_64 Host OS = linux Created = 2016-06-06 11:01:01 ---- Path = test.cpio.gz Size = 72630 Created = 2016-06-06 11:01:01 -- Path = test.cpio.gz Type = gzip Headers Size = 10 (..)
tgz:
7z l test.tgz Scanning the drive for archives: 1 file, 25617349 bytes (25 MiB) Listing archive: test.tgz -- Path = test.tgz Type = gzip Headers Size = 10 (..)
非檔案:
(..) ERROR: test.sh : Can not open the file as archive