1、简单描述

zip用于压缩文件并将文件打包。

unzip与zip相反,解包并解压缩。

2、通过例子说明zip使用方法

(1)、zip命令的使用格式大致是这样的:

zip zipfile file1 file2 file3

以上命令是将file1,file2,file3三个文件先压缩,然后再将这三个压缩后的文件打包到zipfile.zip文件中。

(2)、关于打包后的后缀

zip zipfile.txt file1 file2 file3

以上命令将file1,file2,file3三个文件先压缩,然后再将这三个压缩后的文件打包到zipfile.txt文件中。

(3)打包后原文件是否存留

zip -m zipfile file1 file2 file3

以上命令打包后file1,file2,file3文件已经不存在了,因为选项-m的作用。假如没有-m选项,打包后原文件仍存留。

(4)向打包后的文档中加入评论

zip -z zipfile file1 file2 file3

以上命令执行后,终端会提示你加入评论信息,加入即可。对加入的评论信息,unzip解包时可以查看。

(5)向包中加入包中已有的包会怎样

zip zipfile file1

以上命令执行时,如果zipfile或zipfile.zip已经存在,且其中已经包含file1文件,那么以上命令会更新zipfile包中的file1文件。

还有很多选项,这里不一一介绍,将zip使用文档中的内容粘贴到下面:

zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]The default action is to add or replace zipfile entries from list, whichcan include the special name - to compress standard input.If zipfile and list are omitted, zip compresses stdin to stdout.-f   freshen: only changed files  -u   update: only changed or new files-d   delete entries in zipfile    -m   move into zipfile (delete files)-r   recurse into directories     -j   junk (don't record) directory names-0   store only                   -l   convert LF to CR LF (-ll CR LF to LF)-1   compress faster              -9   compress better-q   quiet operation              -v   verbose operation/print version info-c   add one-line comments        -z   add zipfile comment-@   read names from stdin        -o   make zipfile as old as latest entry-x   exclude the following names  -i   include only the following names-F   fix zipfile (-FF try harder) -D   do not add directory entries-A   adjust self-extracting exe   -J   junk zipfile prefix (unzipsfx)-T   test zipfile integrity       -X   eXclude eXtra file attributes-y   store symbolic links as the link instead of the referenced file-R   PKZIP recursion (see manual)-e   encrypt                      -n   don't compress these suffixes

3、unzip的使用

(1)、unzip的使用方法大概是这样的

unzip zipfile.zip

以上命令,将zipfile.zip包解包,并且将其中的文件解压缩。

(2)只解压出一部分文件

unzip zipfile.zip file1 file2

无论zipfile包中有多少个文件,以上命令只解压出file1,file2两个文件。

(3)、查看压缩包中的评论信息

unzip -z zipfile

以上命令查看zipfile.zip包中的评论信息。这些评论信息是打包的时候用-z选项写进去的。

这里对unzip命令的选项不一一介绍,下面粘贴unzip使用文档中的描述:

Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]Default action is to extract files in list, except those in xlist, to exdir;file[.zip] may be a wildcard.  -Z => ZipInfo mode ("unzip -Z" for usage).-p  extract files to pipe, no messages     -l  list files (short format)-f  freshen existing files, create none    -t  test compressed archive data-u  update files, create if necessary      -z  display archive comment-x  exclude files that follow (in xlist)   -d  extract files into exdirmodifiers:                                   -q  quiet mode (-qq => quieter)-n  never overwrite existing files         -a  auto-convert any text files-o  overwrite files WITHOUT prompting      -aa treat ALL files as text-j  junk paths (do not make directories)   -v  be verbose/print version info-C  match filenames case-insensitively     -L  make (some) names lowercase-X  restore UID/GID info                   -V  retain VMS version numbers-K  keep setuid/setgid/tacky permissions   -M  pipe through "more" pager
Examples (see unzip.txt for more info):unzip data1 -x joe   => extract all files except joe from zipfile data1.zipunzip -p foo | more  => send contents of foo.zip via pipe into program moreunzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer

zip打包,unzip解包相关推荐

  1. Linux中压缩和解压(gzip压缩/gunzip解压)(zip压缩/unzip解压)(tar打包解压)

    文章目录 Linux中压缩和解压(gzip压缩/gunzip解压)(zip压缩/unzip解压)(tar打包解压) 一.gzip压缩 / gunzip解压 1.命令 2.注意 3.案例 4.常用 二. ...

  2. Lua学习教程之 可变參数数据打包与解包

    利用table的pack与unpack进行数据打包与解包.測试代码例如以下: print("Test table.pack()----------------");function ...

  3. 《Python Cookbook 3rd》笔记(3.5):字节到大整数的打包与解包

    字节到大整数的打包与解包 问题 你有一个字节字符串并想将它解压成一个整数.或者,你需要将一个大整数转换为一个字节字符串. 解法 假设你的程序需要处理一个拥有 128 位长的 16 个元素的字节字符串. ...

  4. c语言 udp 解包_UDP打包及解包问题

    UDP打包及解包问题 (2012-04-11 00:12:39) 标签: 打包 包 杂谈 UDP打包及解包问题第一个问题: 想问下在VC++开发平台下,是否提供了UDP协议打包和解包的接口函数?通常所 ...

  5. linux把文件复制到压缩包里,Linux学习笔记(二十)文件压缩 zip压缩、tar打包、打包、解包...

    一.zip压缩 首先安装zip与unzip yum install -y zip/unzip zip 1.txt.zip 1.txt 压缩文件1.txt,压缩文件名称为1.txt.zip zip -r ...

  6. 按压缩格式整理打包(解包)和压缩(解压)命令

    文章目录 一.zip 格式 (一)使用命令 zip 压缩文件 (二)使用命令 unzip 解压 zip 包 二.tar 格式 (一)打包文件 (二)解包 tar 包 三.tar.gz 格式 方式一:利 ...

  7. python list tuple 打包 解包_python的打包与解包

    python的*与**,在函数的定义与调用过程中,有着不同的作用 打包参数: 一.函数定义时,形参前加*号(如:*args):收集实参中所有的位置参数,打包成新元组并将该元组赋值给args变量 实参位 ...

  8. Python中的打包与解包

     解包:Unpacking,比如你儿子去买包子回来分给你的家人. a, *b, c = [1, 2, 3, 4, 5] print(a) # 1 print(b) # [2, 3, 4] print( ...

  9. tp5的通过php文件的打包与解包

    屁话少说,先上代码 <?phpnamespace app\index\controller; use think\Controller;class Zip extends Controller ...

最新文章

  1. 虚拟地址空间以及编译模式
  2. Matcher类:(转)
  3. 基于麻雀优化的BP神经网络(分类应用) - 附代码
  4. 2018计算机应用基础教材,2018年计算机应用基础课件全套PPT电子档.ppt
  5. mysql导出数据到csv文件
  6. 使用beautifulsoup4,爬取一波贴吧的表情包
  7. [Pytorch系列-42]:工具集 - torchvision常见预训练模型的下载地址
  8. GemFire 异步写和同步读
  9. H.266代码学习:decompressCtu和xDecompressCU函数
  10. 出生年月日的html语句,出生年月日五行查询表
  11. Openstack 对象存储服务之争:Ceph或者Swift
  12. google map for Android
  13. 计算机组成原理乘法运算说明过程,计算机组成原理第二章 第8讲 定点乘法运算...
  14. 直播还有哪些新想象?AI+直播打造更有趣的直播间
  15. 标注相关的知识点:强制性标准与推荐性标准
  16. Java爬虫:对猫眼电影进行信息采集并存入Excel
  17. 大脑像一台计算机的数学家,计算机之父冯·诺依曼|他的大脑就是一台超级计算机...
  18. 企业文件服务器搭建案例
  19. linux没有ifconfig命令
  20. 使用Wpf+SDK预览本地摄像头设备

热门文章

  1. 心态崩了,这次我真的要哭了...
  2. 实例113:回文字符串
  3. FMOD.dll的介绍
  4. PHP的Imagick拓展安装
  5. 算法竞赛从入门到进阶pdf_好书送不停 | 算法竞赛入门到进阶
  6. 几个“快递偏门”赚钱方法!
  7. 比尔盖茨开通微信公众号斩获10万+,但微博可能更适合他
  8. 灵魂9问:网络世界有哪些不为人知的秘密?(网络面试必考)
  9. 只有他,能在西方拍摄出东方的江湖
  10. 网站突然报错:502 Bad Gateway