Home > php教程 > PHP开发 > body text

Detailed explanation of linux unzip command parameters and usage--linux unzip file command

高洛峰
Release: 2016-12-12 16:51:57
Original
2670 people have browsed it

Function description: Unzip zip file

Syntax: unzip [-cflptuvz][-agCjLMnoqsVX][-P ][.zip file][file][-d ][-x ] or unzip [-Z]

Additional note: unzip is a decompression program for .zip compressed files.

Parameters:

-x file list Decompress files, but do not include the specified file file.

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

-t tests whether the file is damaged but does not decompress it.

-d directory Extract the compressed file to the specified directory.

-z only displays comments for compressed files.

-n Do not overwrite existing files.

-o overwrites an existing file without asking for user confirmation.

-j does not rebuild the directory structure of the document, and extracts all files into the same directory.

-j parameter . For example:

[root@localhost ~]# cd a
[root@localhost a]# unzip -j myfile
Archive: myfile.zip
inflating: install.log inflating: anaconda-ks.cfg inflating: install. log.syslog

will decompress all the files in myfile into the current directory a, removing the directory structure in myfile.

Example 1: Unzip the compressed file text.zip in the current directory.

$ unzip text.zip

 

Example 2: Decompress 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 text.zip -d /tmp

 

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

$ unzip -v text.zip

zgrep command

The function of this command is to find matching regular expressions in compressed files. The usage is the same as the grep command, except that the operation object is compressed files. If the user wants to see if there is a certain sentence in a compressed file, he can use the zgrep command.

Example:

Package all files and folders in the directory /home/Blinux /html/ into html.zip in the current directory

zip –q –r html.zip /home/Blinux /html

The above command operation is to compress files and folders with absolute addresses. The compression relative path directory is given below

For example, in the Bliux directory, performing the following operations can achieve the same effect as above.

zip –q – r html.zip html

For example, in my html directory now, the zip compression command I operate is

zip –q –r html.zip *

The above is done in quiet mode and includes system files and hidden files. Contains files

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template