Linuxzip/unzip command

Source: Internet
Author: User
Decompress the compressed file test.zip under the specified directory tmp. if the same file already exists, the unzip command must overwrite the original file. Unzip

Command name: zip

 


Function description: compress a file.

Syntax: zip [-AcdDfFghjJKlLmoqrSTuvVwXyz $] [-B <工 作目录> ] [-Ll] [-n <字 尾字符串> ] [-T <日 期时间> ] [- <压 缩效率> ] [Shrink files] [files...] [-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: tune 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 try 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 makes the file name in a MS-DOS-compatible format.

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

-Replace the LF + CR character with the LF character during ll compression.

-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 does not show the instruction execution process.

-R: process all files and subdirectories in the specified directory.

The-S package contains 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 is used to change a newer file to a 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 conditions during scaling.

-X does not save additional file attributes.

-Y is directly connected to save the symbolic connection, rather than the file to which the connection points. this parameter is only valid in UNIX-like 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.

 


Example

 


1. compress test. MYI

Zip test1.zip test. MYI

2. compress test. MYI with a compression ratio of 8

Zip test2.zip-8 test. MYI

3.compress all files and folders under the current directory into a test.zip file.-r indicates recursive compression of all files under the subdirectory

Zip-r test.zip ./*

4. Packaging Directory

Zip test2.zip test2/* or zip test2.zip test2

5.delete the test. MYI file in test1.zip.

Zip-d test1.zip test. MYI

6. delete the files in the directory of the package.

Zip-d test2.zip test2/ln. log

7.add the test. MYI file to test1.zip.

Zip-m test1.zip test. MYI

8. exclude a file when compressing the file

Zip test3.zip tests/*-x tests/ln. log

 


========================================================== ========================================

 


Command name: unzip

 


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 updates the 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 ., However, it is hard to understand the pressure.

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

-V indicates that the detailed information is displayed. Or view the compressed file directory.

-Z only displays the remarks of the compressed file.

-A performs necessary character conversion on text files.

-B does not need to convert characters in text files.

-The file name in the C-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 more sequential processing.

-N do not overwrite the original file during decompression.

-O does not need to ask the user first. the unzip command will be executed and overwrite the original file.

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

-When q runs, no information is displayed.

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

-V retains the file version information of VMS.

-X stores 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.

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

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

-Z unzip-Z is used to execute the zipinfo command.

 

 

 


1. decompress the text.zip file in the current directory.

Unzip test.zip

2.decompress the compressed file text.zip under the specified directory/tmp. if the same file already exists, the unzip command must not overwrite the original file.

Unzip-n test.zip-d/tmp

3. view the Directory of the compressed file, but the file cannot be compressed.

Unzip-v test.zip

4.decompress the compressed file test.zip in the specified directory tmp. if the same file already exists, the unzip command must overwrite the original file.

Unzip-o test.zip-d tmp/


 

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.