Home >Operation and Maintenance >Linux Operation and Maintenance >How to unzip a file using unzip command
The unzip command is used to expand documents compressed in zip format. In this article, we will introduce the specific method of using unzip to decompress files under Linux.
#ZIP format files are a compression format, usually used to compress directories and multiple files, and the extension of ZIP compressed files is ".zip".
ZIP is a compression format used not only on Linux but also on various operating systems such as Windows and Mac.
The unzip command is written as follows
$ unzip 目标文件
Basically, if a zip file is specified as a parameter, the file will be expanded.
Selection of unzip command
Description | |
Run-time output result | |
Specify and expand the directory | |
Confirm the contents of the compressed file | |
Test whether it can be decompressed normally |
How to use the unzip command
We will use the unzip command to unzip the document "test.zip".$ unzip test.zipIf the file exists when expanding, it will be displayed as follows.
$ replace test/test1.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: n
Specify the directory when using -d to decompress
If you want to use the unzip command to expand the ZIP file in the specified directory, please use the "-d" option. The following is the unzipped document in the directory tmp.$ unzip -d tmp test.zip
-l Confirm the contents of the compressed file
$ unzip -l test.zip
Use -t to test whether it can be decompressed normally
$ unzip -t test.zipIf No errors are detected in the compressed data of "test.zip" and it can be decompressed normally.
The above is the detailed content of How to unzip a file using unzip command. For more information, please follow other related articles on the PHP Chinese website!