Linux commands (16) Compress or unzip files and directories zip unzip

Source: Internet
Author: User

Directory

1. Introduction to Commands

2. Common parameter Introduction

3. Example

4. Direct access to the bottom

Introduction to Commands

Zip is a widely used compression program under the Linux system, and the file is compressed with a ". zip" extension. The zip command is used to compress the file into a common zip format, and the unzip command is used to extract the zip file.

Back to Catalog

Common parameters Introduction

The common parameters of the zip command are as follows:

-a 将文件转成 ASCⅡ 模式-F 尝试修复损坏的压缩文件-h 显示帮助界面-m 将文件压缩后,删除源文件-n 不压缩具有特定字尾字符串的文件-o 将压缩文件内的所有文件的最新变动时间设置为压缩时候的时间-q 安静模式,在压缩的时候不显示命令的执行过程-r 将制定的目录下的所有子目录以及文件一起处理-S 包含系统文件和隐含文件-t 把压缩文件的最后修改日期设置为指定的日期,日期格式为 mmddyyyy-x-v 查看压缩文件目录,但不解压-t 测试压缩文件有无损坏,但不解压-d 把压缩文件解压到指定目录下-z 只显示压缩文件的注解-o 覆盖已存在的文件且不要求用户确认-j 不重建文档的目录结构,把所有文件解压到同一目录下

Back to Catalog

Instance

The basic usage of the zip command is:

zip [参数] [打包后的文件名] [打包的目录路径]   

Note: The path can either be a relative path or an absolute path

1. Compress files:

zip file.conf.zip  file.conf

2. Compress the entire folder into one file:

zip -r file_backup.zip   .   点表示当前目录

3. Unzip the file:

unzip file.conf.zip

4. Do not ask for direct coverage when extracting:

unzip -o file.conf.zip

5. Extract the files to the specified folder:

unzip file.conf.zip -d  /data/bak

6. View the contents of the compressed package but do not understand the pressure

unzip -v file.conf.zip

7. View the contents of the compressed file:

zcat file.conf.gz

Back to Catalog

Linux commands (16) Compress or unzip files and directories zip unzip

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.