Linux decompression and compression zip package introduction

Source: Internet
Author: User
The zip command can be used to compress files into common zip formats. The unzip command is used to decompress the zip file.

Linux zip command details

Function description: compress a file.

Syntax: zip [-AcdDfFghjJKlLmoqrSTuvVwXyz $] [-B <工作目录> ] [-Ll] [-n <字尾字符串> ] [-T <日期时间> ] [- <压缩效率> ] [Compressed file] [file...] [-I <范本样式> ] [-X <范本样式> ]

Note: zip is a widely used compression program. after files are compressed, other compressed files with the ". zip" extension will be generated.

Parameters:

-A: adjust the executable automatic decompression file.

-B <工作目录> Specifies the directory for storing files temporarily.

-C adds comments to each compressed file.

-D. delete the specified file from the compressed file.

-D. The directory name is not created in the compressed file.

-F this parameter works similarly to the specified "-u" parameter, but not only updates existing files, if some files do not exist in the compressed file, this parameter is used to add it to the compressed file.

-F tries to repair damaged compressed files.

-G compresses the file and attaches it to the existing compressed file, instead of creating a new compressed file.

-H online help.

-I <范本样式> Only files that meet the criteria are compressed.

-J only saves the file name and its content, without storing any directory name.

-J: delete unnecessary data before the compressed file.

-K uses a file name in MS-DOS-compatible format.

-L replace the LF character with the LF + CR character when compressing the file.

-Replace the LF + CR character with the LF character when compressing the file.

-L displays the copyright information.

-M: After compressing the file and adding it to the compressed file, delete the original file, that is, move the file to the compressed file.

-N <字尾字符串> Do not compress files with specific character strings.

-O the file with the latest change time in the compressed file is used as the standard, and the change time of the compressed file is set to the same as that of the file.

-Q: The command execution process is not displayed.

-R recursive processing: All files and subdirectories in the specified directory are processed together.

-S contains the system and hidden files.

-T <日期时间> Set the date of the compressed file to the specified date.

-T check whether each file in the backup file is correct.

-U replace the newer file into the compressed file.

-V displays the command execution process or version information.

-V stores the file attributes of the VMS operating system.

-W indicates the version number in the file name. this parameter is only valid in the VMS operating system.

-X <范本样式> Exclude files that meet the criteria during compression.

-X does not save additional file attributes.

-Y directly saves the symbolic connection, not the file pointed to by the connection. this parameter is only valid in UNIX and other systems.

-Z adds comments to the compressed file.

-$ Name of the volume on which the first compressed file is stored.

- <压缩效率> The compression efficiency is a value between 1 and 9.

Linux unzip command details

Function description: decompress the zip file.

Syntax: unzip [-cflptuvz] [-agCjLMnoqsVX] [-P <密码> [[.Zip file] [file] [-d <目录> ] [-X <文件> ] Or unzip [-Z]

Note: unzipis the decompression program for. ZIP compressed files.

Parameters:

-C displays the extracted results on the screen and converts the characters properly.

-F: update an existing file.

-L displays the files contained in the compressed file.

The-p parameter is similar to the-c parameter. the decompressed result is displayed on the screen, but no conversion is performed.

-T check whether the compressed file is correct.

The-u parameter is similar to the-f parameter, but in addition to updating existing files, other files in the compressed file are also extracted to the directory.

-V displays detailed information when executing the command.

-Z only displays the remarks of the compressed file.

-A performs necessary character conversion on text files.

-B. do not convert characters in text files.

-C: The file name in the compressed file is case sensitive.

-J does not process the original directory path of the compressed file.

-L change all file names in the compressed file to lowercase letters.

-M sends the output result to the more Program for processing.

-N do not overwrite the original file during decompression.

-O does not need to ask the user first. after unzip is executed, it overwrites the original file.

-P <密码> Use the zip password option.

-No information is displayed when q is executed.

-S converts the white space characters in the file name to the bottom line characters.

-V retains the file version information of VMS.

-X: saves the original UID/GID of the file at the same time during decompression.

. ZIP file] specifies the. zip compressed file.

[File] specifies the files in the. zip compressed file to be processed.

-D <目录> Specifies the directory to be stored after the file is decompressed.

-X <文件> Specifies which files in the. zip compressed file are not processed.

-Z unzip-Z is equivalent to executing the zipinfo command.

Example:

The zip command can be used to compress files into common zip formats. The unzip command is used to decompress the zip file.

1. I want to compress a file abc.txtand a directory dir1into yasuo.zip:

# Zip-r yasuo.zip abc.txt dir1

2. I downloaded a yasuo.zip file and want to decompress it:

# Unzip yasuo.zip

3. I have abc1.zip, abc2.zip, and abc3.zip under the current directory. I want to decompress them together:

# Unzip abc \?. Zip

Note :? Represents a single character. if "*" is used, it indicates any number of characters.

4. I have a large compressed file large.zip. I don't want to decompress it. I just want to see what it contains:

# Unzip-v large.zip

5. I downloaded a compressed file large.zip and want to verify whether the downloaded file is complete.

# Unzip-t large.zip

6. I used -v8.0 to find that there are many directories and subdirectories in the music.zip compressed file, and the subdirectories are actually mp3 files. I want to download these files to the first-level directory instead of the first-level Directory:

# Unzip-j music.zip

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.