zipinfo命令来自于英文词组“zip information”的缩写,其功能是用于查看压缩文件信息。zipinfo命令可以查看zip格式压缩包内的文件列表及详细信息。

语法格式:zipinfo [参数] 压缩包

常用参数:

-1 只列出文件名称
-h 只列出压缩文件名称
-l列出原始文件的大小
-m 列出每个文件的压缩率
-M 以分页形式显示内容
-s 列出压缩文件内容
-t 列出压缩前后大小及压缩率
-T 列出每个文件的日期时间
-v 详细显示每一个文件的信息
-x<范本样式> 不列出符合条件的文件的信息
-z 将注释显示出来

参考实例

显示压缩包内的文件名称及简要属性信息:

[root@linuxcool ~]# zipinfo file.zip 
Archive:  file.zip
Zip file size: 1937 bytes, number of entries: 2
-rw-------  3.0 unx     1256 tx defN 21-Dec-14 08:42 anaconda-ks.cfg
-rw-r--r--  3.0 unx     1585 tx defN 21-Dec-14 08:43 initial-setup-ks.cfg
2 files, 2841 bytes uncompressed, 1589 bytes compressed:  44.1%

显示压缩包内的文件名称及详细属性信息:

[root@linuxcool ~]# zipinfo -v file.zip 
Archive:  file.zip
There is no zipfile comment.

End-of-central-directory record:
-------------------------------

  Zip archive file size:                      1937 (0000000000000791h)
  Actual end-cent-dir record offset:          1915 (000000000000077Bh)
  Expected end-cent-dir record offset:        1915 (000000000000077Bh)
  (based on the length of the central directory and its expected offset)

  This zipfile constitutes the sole disk of a single-part archive; its
  central directory contains 2 entries.
  The central directory is 175 (00000000000000AFh) bytes long,
  and its (expected) offset in bytes from the beginning of the zipfile
  is 1740 (00000000000006CCh).
………………省略部分输出信息………………

仅显示压缩包内文件大小及数目信息:

[root@linuxcool ~]# zipinfo -h file.zip
Archive:  file.zip
Zip file size: 1937 bytes, number of entries: 2

仅显示压缩包内文件最后修改时间及简要属性信息:

[root@linuxcool ~]# zipinfo -T file.zip 
Archive:  file.zip
Zip file size: 1937 bytes, number of entries: 2
-rw-------  3.0 unx     1256 tx defN 20211214.084220 anaconda-ks.cfg
-rw-r--r--  3.0 unx     1585 tx defN 20211214.084343 initial-setup-ks.cfg
2 files, 2841 bytes uncompressed, 1589 bytes compressed:  44.1%
Author