【Linux】一步一步学Linux——zipinfo命令(69)

00. 目录

01. 命令概述

zipinfo命令的全称为“zip information”,该命令用于列出压缩文件信息。执行zipinfo指令可得知zip压缩文件的详细信息。

02. 命令格式

zipinfo [-12hlmMstTvz][压缩文件][文件...][-x <范本样式>]

03. 常用选项

-1:只列出文件名称;
-2:此参数的效果和指定“-1”参数类似,但可搭配“-h”,“-t”和“-z”参数使用;
-h:只列出压缩文件的文件名称;
-l:此参数的效果和指定“-m”参数类似,但会列出原始文件的大小而非每个文件的压缩率;
-m:此参数的效果和指定“-s”参数类似,但多会列出每个文件的压缩率;
-M:若信息内容超过一个画面,则采用类似more指令的方式列出信息;
-s:用类似执行“ls-l”指令的效果列出压缩文件内容;
-t:只列出压缩文件内所包含的文件数目,压缩前后的文件大小及压缩率;
-T:将压缩文件内每个文件的日期时间用年,月,日,时,分,秒的顺序列出;
-v:详细显示压缩文件内每一个文件的信息;
-x<范本样式>:不列出符合条件的文件的信息;
-z:如果压缩文件内含有注释,就将注释显示出来。

04. 参考示例

4.1 显示压缩文件信息

[deng@localhost test]$ zipinfo file.zip 
Archive:  file.zip
Zip file size: 1610 bytes, number of entries: 4
-rwxrwxr-x  3.0 unx      520 tx defN 19-Jul-28 21:59 a.sh
-rwxrwxr-x  3.0 unx      520 tx defN 19-Jul-28 21:59 b.sh
-rwxrwxr-x  3.0 unx      520 tx defN 19-Jul-28 21:59 c.sh
-rwxrwxr-x  3.0 unx      520 tx defN 19-Jul-28 21:59 d.sh
4 files, 2080 bytes uncompressed, 1044 bytes compressed:  49.8%
[deng@localhost test]$ 

4.2 显示压缩文件中每个文件的信息

[deng@localhost test]$ zipinfo -v file.zip 
Archive:  file.zip
There is no zipfile comment.

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

  Zip archive file size:                      1610 (000000000000064Ah)
  Actual end-cent-dir record offset:          1588 (0000000000000634h)
  Expected end-cent-dir record offset:        1588 (0000000000000634h)
  (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 4 entries.
  The central directory is 296 (0000000000000128h) bytes long,
  and its (expected) offset in bytes from the beginning of the zipfile
  is 1292 (000000000000050Ch).

4.3 只显示压缩包大小、文件数目

[deng@localhost test]$ zipinfo -h file.zip 
Archive:  file.zip
Zip file size: 1610 bytes, number of entries: 4
[deng@localhost test]$ 

4.4 生成一个基本的、长格式的列表,包括标题和总计行

[deng@localhost test]$ zipinfo -l file.zip 
Archive:  file.zip
Zip file size: 1610 bytes, number of entries: 4
-rwxrwxr-x  3.0 unx      520 tx      261 defN 19-Jul-28 21:59 a.sh
-rwxrwxr-x  3.0 unx      520 tx      261 defN 19-Jul-28 21:59 b.sh
-rwxrwxr-x  3.0 unx      520 tx      261 defN 19-Jul-28 21:59 c.sh
-rwxrwxr-x  3.0 unx      520 tx      261 defN 19-Jul-28 21:59 d.sh
4 files, 2080 bytes uncompressed, 1044 bytes compressed:  49.8%
[deng@localhost test]$ 

4.5 将压缩文件内每个文件的日期时间用年,月,日,时,分,秒的顺序列出

[deng@localhost test]$ zipinfo -T file.zip 
Archive:  file.zip
Zip file size: 1610 bytes, number of entries: 4
-rwxrwxr-x  3.0 unx      520 tx defN 20190728.215900 a.sh
-rwxrwxr-x  3.0 unx      520 tx defN 20190728.215906 b.sh
-rwxrwxr-x  3.0 unx      520 tx defN 20190728.215909 c.sh
-rwxrwxr-x  3.0 unx      520 tx defN 20190728.215913 d.sh
4 files, 2080 bytes uncompressed, 1044 bytes compressed:  49.8%
[deng@localhost test]$ 

4.6 查看存档中最近修改的文件,排序列出

[deng@localhost test]$ zipinfo -T file.zip | sort -nr -k 7 
-rwxrwxr-x  3.0 unx      520 tx defN 20190728.215913 d.sh
-rwxrwxr-x  3.0 unx      520 tx defN 20190728.215909 c.sh
-rwxrwxr-x  3.0 unx      520 tx defN 20190728.215906 b.sh
-rwxrwxr-x  3.0 unx      520 tx defN 20190728.215900 a.sh
Zip file size: 1610 bytes, number of entries: 4
Archive:  file.zip
4 files, 2080 bytes uncompressed, 1044 bytes compressed:  49.8%
[deng@localhost test]$ 

05. 附录

参考:【Linux】一步一步学Linux系列教程汇总

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值