Example Usage of linux Compressed File Command zip

  • 2021-07-22 12:14:38
  • OfStack

Windows system uses ". zip" format compressed files. In fact, ". zip" format files are common compressed file types in Windows and Linux systems, belonging to one of several mainstream compression formats (zip, rar, etc.), and are quite simple storage formats for compressing each file separately.

Usage of linux Compressed File Command zip

zip [Option] Compressed package name source file or source directory list

Options:

选项 含义
-r 递归压缩目录,及将制定目录下的所有文件以及子目录全部压缩。
-m 将文件压缩之后,删除原始文件,相当于把文件移到压缩文件中。
-v 显示详细的压缩过程信息。
-q 在压缩的时候不显示命令的执行过程。
-压缩级别 压缩级别是从 1~9 的数字,-1 代表压缩速度更快,-9 代表压缩效果更好。
-u 更新压缩文件,即往压缩文件中添加新文件。

Use example:

1. Compress a single file


zip ana.zip anaconda-ks.cfg

2. Compress multiple files


zip test.zip install.log install.log.syslog

3. Compress the folder


zip -r dir1.zip dir1

The above is the linux compressed file command zip usage details, thank you for learning and support for this site.


Related articles: