Unzip the zip file under ubuntu


1. Function: decompress the zip file

2. Location: /usr/bin/unzip

3. Format usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]

4. Main parameters

  • -c Display the decompressed result on the screen, and convert the characters appropriately
  • -p is similar to the -c parameter, and will display the decompressed result on the screen, but will not perform any conversion.
  • -l displays the files contained in the compressed file
  • -f update existing files
  • -t check the compressed file is correct, but do not decompress
  • -u is similar to the -f parameter, but in addition to updating existing files, other files in the compressed file will also be extracted into the directory
  • -z only show the comment text of the compressed file
  • -v Display detailed information when executing yes. Or view the compressed file directory, but do not extract
  • -T Set the latest change time of all files in the compressed file to the time when it was decompressed
  • -x specifies which files in the .zip archive should not be processed
  • -d specifies the directory where the files will be stored after decompression
  • -n Do not overwrite the original file when decompressing
  • -q Quiet mode, do not display any information during execution
  • -o No need to ask the user first, the original file will be overwritten after unzip is executed
  • -a Perform necessary character conversions on text files
  • -j do not process the original directory path in the compressed file
  • -aa treat all file directories as text
  • -U use escapes for all non-ASCII Unicode
  • -UU ignore Unicode encoded characters
  • -C File names in archives are case sensitive
  • -L Change all filenames in the compressed file to lowercase
  • -X Save the original UID/GID of the file at the same time when decompressing
  • -V keep VMS file version information
  • -K preserve setuid/setgid/tacky attributes of files
  • -M Send the output to the more program for processing
  • -O specifies character encoding for DOS, Windows and OS/2
  • -I specifies the character encoding as UNIX

5. Application example
1. Unzip the file to the current directory

unzip test.zip

2. If you want to decompress the file to the specified directory, you need to use the -d parameter.

unzip -d /temp test.zip

3、解压的时候,有时候不想覆盖已经存在的文件,那么可以加上-n参数

unzip -n test.zip
unzip -n -d /temp test.zip

4、只看一下zip压缩包中包含哪些文件,不进行解压缩

unzip -l test.zip

5、查看显示的文件列表还包含压缩比率

unzip -v test.zip

6、检查zip文件是否损坏

unzip -t test.zip

7、将压缩文件test.zip在指定目录tmp下解压缩,如果已有相同的文件存在,要求unzip命令覆盖原先的文件

unzip -o test.zip -d /tmp/

Guess you like

Origin blog.csdn.net/zs520ct/article/details/72935141