Home  >  Article  >  Operation and Maintenance  >  How to use the unzip decompression command

How to use the unzip decompression command

青灯夜游
青灯夜游Original
2023-02-24 14:34:3522384browse

The unzip decompression command is used to view and decompress the ".zip" files compressed by the zip command. It can list, test and extract the compressed files in the ZIP archive. The syntax format is "unzip [option] compressed package name "; Commonly used option parameters include "-d directory name", "-n", "-o", "-v", "-t", and "-x file list".

How to use the unzip decompression command

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

unzip command: Unzip zip files

The unzip command is used to view and decompress zip files and can list, test and extract ZIP archives Compressed file;

Command syntax

unzip [选项] 压缩包名

All options:

  • -c Display the decompression result to the screen and perform appropriate conversion of characters;

  • -f updates existing files;

  • -l displays the contents contained in the compressed file file;

  • -p is similar to the -c parameter, the decompression result will be displayed on the screen, but no conversion will be performed;

  • -t checks whether the compressed file is correct;

  • -u is similar to the -f parameter, but in addition to updating existing files, other files in the compressed file will also be updated. Unzip to the directory;

  • -v displays detailed information when executed;

  • -z only displays the comment text of the compressed file;

  • -a Perform necessary character conversion on the text file;

  • -b Do not perform character conversion on the text file;

  • -C The file name in the compressed file is case-sensitive;

  • -j The original directory path in the compressed file is not processed;

  • -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 files when decompressing;

  • -o Do not ask the user first, overwrite the original files after unzip is executed;

  • -P Use the password option of zip;

  • -q does not display any information when executing;

  • -s Converts blank characters in the file name to underscore characters;

  • -V retains the VMS file version information;

  • -X Solution When compressing, the original UID/GID of the file will be saved at the same time;

  • -d Specify the directory where the file will be stored after decompression;

  • -x specifies which files in the .zip compressed file are not to be processed;

  • -Z unzip-Z is equivalent to executing the zipinfo command.

Commonly used:

Option Meaning
- d Directory name Extract the compressed file to the specified directory.
-n Existing files will not be overwritten when decompressing.
-o Overwrites existing files during decompression without user confirmation.
-v View the detailed information of the compressed file, including the file size, file name, compression ratio, etc. contained in the compressed file, but does not perform decompression operations.
-t Tests whether the compressed file is damaged, but does not decompress it.
-x File List Extract files, but do not include the files specified in the file list.

命令示例

1、unzip test5.zip 解压压缩文件test5.zip到当前目录;

How to use the unzip decompression command

2、unzip -l test5.zip 

-l 表示在不解压的情况下查看压缩文件内的文件;

How to use the unzip decompression command

3、unzip -v test5.zip 

-v 表示在不解压的情况下查看压缩文件内的文件,且显示更多信息(压缩比率等);

How to use the unzip decompression command

4、unzip -q test.zip

-q 表示不显示执行过程;

[root@localhost data]# unzip -q test.zip

5、unzip -o test.zip 

-o 表示不询问用户,覆盖原有文件;

How to use the unzip decompression command

 6、unzip -q -d /data/test/test5 test.zipunzip -q test.zip -d /data/test/test5) 

-d 表示指定文件解压缩后所要存储的目录(-d 后面必须接路径,不然会报错,且当路径不存在时会自动创建);

How to use the unzip decompression command

相关推荐:《Linux视频教程

The above is the detailed content of How to use the unzip decompression command. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn