unzip

Used to decompress archives compressed by the zip command

Supplementary instructions

unzip command is used to decompress the ".zip" compressed package compressed by the zip command.

grammar

unzip(option)(parameter)

Options

-c: Display the decompression result on the screen and perform appropriate conversion of characters;
-f: update existing files;
-l: Display the files contained in the compressed file;
-p: Similar to the -c parameter, the decompression result will be displayed on the screen, but no conversion will be performed;
-t: Check whether the compressed file is correct;
-u: Similar to the -f parameter, but in addition to updating existing files, other files in the compressed file will also be decompressed into the directory;
-v: Display detailed information during execution;
-z: Only display the comment text of the compressed file;
-a: Perform necessary character conversion on the text file;
-b: Do not perform character conversion on text files;
-C: File names in compressed files are case-sensitive;
-j: Do not process the original directory path in the compressed file;
-L: Change all file names in the compressed file to lowercase;
-M: Send the output results to the more program for processing;
-n: Do not overwrite the original file when decompressing;
-o: No need to ask the user first, the original file will be overwritten after unzip is executed;
-P<password>: Use zip password option;
-q: Do not display any information during execution;
-s: Convert whitespace characters in the file name to underscore characters;
-V: retain VMS file version information;
-X: Save the original UID/GID of the file at the same time when decompressing;
-d<directory>: Specify the directory where the file will be stored after decompression;
-x<file>: Specify which files in the .zip compressed file are not to be processed;
-Z: unzip -Z is equivalent to executing the zipinfo command.

Parameters

Compressed package: Specify the ".zip" compressed package to be decompressed.

Example

Unzip the compressed file text.zip in the current directory.

unzip test.zip

Unzip the compressed file text.zip in the specified directory /tmp. If the same file already exists, the unzip command is required not to overwrite the original file.

unzip -n test.zip -d /tmp

View the compressed file directory, but do not decompress it.

unzip -v test.zip

Unzip the compressed file test.zip in the specified directory /tmp. If the same file already exists, require the unzip command to overwrite the original file.

unzip -o test.zip -d tmp/

Unzip the specified file, * is used as a wildcard character.

unzip test.zip "*.jpg"