Linux zip unzip file decompression command set

Source: Internet
Author: User
Tags decompress zip

Linux zip unzip file decompression command set
Zip is one of the common compression and compression commands in linux. After the file is compressed, it will generate another file ". zip "extension of the compressed file, because zip can be easily used in windows, so zip is a widely used compression program.

Syntax: zip [-acddffghjjkllmoqrstuvvwxyz $] [-B <working directory>] [-ll] [-n <character string>] [-t <date and time>] [-<compression efficiency>] [compressed file] [file...] [-I <template style>] [-x <template style>]

Parameters:
-I <template style> only compresses files that meet the conditions.
-J only saves the file name and its content, without storing any directory name.
-J: Delete unnecessary data before the compressed file.
-K uses the file name in ms-dos compatibility 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 <character string> does 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 <date and time> sets 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 <template style> files that meet the condition are excluded 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.
-<Compression efficiency> the compression efficiency is a value ranging from 1 to 9.
-A: Adjust the executable automatic decompression file.
-B <working directory> specifies the directory for temporarily storing files.
-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.

There are few syntaxes and parameters. In fact, it is enough to remember what is commonly used.

Basic usage: zip [parameter] [package file name] [Package directory path]

Parameter:-a converts a file to ascii mode.
-F try to repair damaged compressed files
-H: display the Help Page
-M: after compressing the file, delete the source file.

-N the specified string does not compress the file with the specified character string.
-O sets the latest change time of all files in the compressed file to the compression time.
-Q quiet mode. The command execution process is not displayed during compression.
-R processes all subdirectories and files in the specified directory together.
-S contains system files and implicit files (s is capital)

For example:

Zip-q-r ad.zip/home/public_html/ad

The above command is to pack all the files and directories in the/home/public_html/ad/directory and generate the ad.zip file under the current directory.

You can also use the zip command to process multiple files and directories at the same time by listing them one by one and using the space interval:

Zip-q-r ad.zip file1 file2/home/public_html/ad

The above command is to package all the files and directories in the/home/public_html/ad/directory and file1 file2 together.

Unzip command

Decompress zip files in windows.

Syntax: unzip [-cflptuvz] [-agcjlmnoqsvx] [-p <password> ][.zip file] [file] [-d <directory>] [-x <File>] Or unzip [-z]

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 <password> 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 <directory> specifies the directory to be stored after the file is decompressed.
-X <File> indicates which files in the. ZIP file are not processed.
-Z unzip-z is equivalent to executing the zipinfo command.

For example, decompress the generated ad.zip file.

Unzip ad.zip

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.