English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux unzip command

Linux Command大全

The Linux unzip command is used to decompress zip files

unzip is a decompression program for .zip compressed files.

Syntax

unzip [-cflptuvz][-agCjLMnoqsVX][-P <password>][.zip file][file][-d <directory>][-x <file>] or unzip [-Z]

Parameters:

  • -c Display the decompression results on the screen and perform appropriate character conversions.
  • -f Update existing files.
  • -l Display the files contained in the compressed file.
  • -p Similar to-c Similar to parameter c, it will display the decompression results on the screen but will not perform any conversions.
  • -t Check if the compressed file is correct.
  • -u Similar to-f Similar to parameter f, but it will also decompress other files in the compressed file into the directory in addition to updating existing files.
  • -v Display detailed information during execution.
  • -z Only display the remark text of the compressed file.
  • -a Perform necessary character conversions on text files.
  • -b Do not perform character conversion on text files.
  • -C The filenames in the compressed file are case-sensitive.
  • -j Do not process the original directory paths in the compressed file.
  • -L Change all filenames in the compressed file to lowercase.
  • -M Send the output results to the more program for processing.
  • -n Do not overwrite the original files during decompression.
  • -o It is not necessary to ask the user; the original file will be overwritten after unzip execution.
  • -P<password> Use the zip password option.
  • -q Do not display any information when executing.
  • -s Convert whitespace characters in file names to underscore characters.
  • -V Retain the file version information of VMS.
  • -X Restore the original UID of the file when decompressing./GID.
  • [.zip file] Specify the .zip compressed file.
  • [file] Specify which files in the .zip compressed file should be processed.
  • -d<directory> Specify the directory where the files should be stored after decompression.
  • -x<file> Specify which files in the .zip compressed file should not be processed.
  • -Z unzip -Z equals to execute zipinfo command.

Online Examples

View the files contained in the compressed file:

# unzip -l abc.zip 
Archive: abc.zip
 Length   Date  Time  Name
--------  ----  ----  ----
  94618 05-21-10 20:44  a11.jpg
  202001 05-21-10 20:44  a22.jpg
    16 05-22-10 15:01  11.txt
  46468 05-23-10 10:30  w456.JPG
  140085 03-14-10 21:49  my.asp
--------          -------
  483188          5 files

-v Parameter is used to view the directory information of the compressed file, but does not decompress the file.

# unzip -v abc.zip 
Archive: abc.zip
Length  Method  Size Ratio  Date  Time  CRC-32  Name
-------- ------ ------- -----  ----  ----  ------  ----
  94618 Defl:N  93353  1% 05-21-10 20:44 9e661437 a11.jpg
 202001 Defl:N  201833  0% 05-21-10 20:44 1da462eb a22.jpg
   16 Stored    16  0% 05-22-10 15:01 ae8a9910 ? +-|¥+-? (11).txt
  46468 Defl:N  39997 14% 05-23-10 10:30 962861f2 w456.JPG
 140085 Defl:N  36765 74% 03-14-10 21:49 836fcc3f my.asp
--------     ------- ---              -------
 483188      371964 23%              5 files

Linux Command大全