The basic usage of the Linux zip command is:
Zip [parameters] [file name after packaging] [packaged directory path]
Linux zip command parameter list:
-a convert the file to ASCII mode
-F attempt to repair corrupted compressed file
-H Display Help interface
-M after compressing the file, delete the source file
-N specific string does not compress files with a specific trailing string
-O to set the latest change time for all files in the compressed file to the time of compression
-Q Quiet mode, does not show the execution of instructions during compression
-R processes all subdirectories and files in the specified directory
-S contains system files and implied files (S is uppercase)
-T date sets the last modified date of the compressed file to the specified date, and the date format is mmddyyyy
Example:
Package all files and folders under this directory as Html.zip in the current directory/home/blinux/html/
Zip–q–r html.zip/home/blinux/html
The above command operation is to compress the absolute address files and folders. The following is a list of compression relative paths
For example, in Bliux this directory, do the following to achieve the same effect.
Zip–q–r Html.zip HTML
For example, now my HTML directory, I manipulate the zip compression command is
Zip–q–r Html.zip *
The above is done in quiet mode, and contains system files and hidden files
//////////////////////////////////////////////////////////
Unzip syntax:
Unzip [-cflptuvz][-agcjlmnoqsvx][-p < password >][.zip file] [file][-d < directory >][-x < file;] or unzip [-z]
Additional note: Unzip is the unzip program for. zip compressed files.
Unzip parameters:
-C Displays the extracted results to the screen and converts the characters appropriately.
-F Updates an existing file.
-L Displays the files contained within the compressed file.
-P, similar to the-c parameter, displays the results of the decompression to the screen, but does not perform any conversions.
-T checks that 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 are extracted to the directory.
-V performs yes when the detailed information is displayed.
-Z Displays only the memo text of the compressed file.
-A necessary character conversion for the text file.
-B Do not convert the text file to character.
The file names in the-C compressed file are case sensitive.
-J does not handle directory paths that are contained in compressed files.
-L Changes all the file names in the compressed file to lowercase.
-M sends the output to the more program processing.
-N Do not overwrite the original file when extracting.
-O do not need to ask the user first, unzip overwrite the original file after execution.
-p< password > password using zip option.
-Q does not display any information when executing.
-S converts white space characters in the file name to baseline characters.
-V retains the file version information for the VMS.
-X Unzip while the original uid/gid of the file is stored back.
[. zip file] Specifies a. zip compressed file.
[file] Specifies which files in the. zip archive to process.
-d< directory > Specifies the directory to be stored after the file has been decompressed.
-x< file > Specifies which files in the. zip archive are not processed.
-Z unzip-z equals execute zipinfo Instruction
Example:
Extract the/home/blinux/html.zip to the current directory
Linux comes with the unzip command to decompress compressed files in ZIP format under Windows.
Unzip command
Syntax: Unzip [options] Compress file name. zip
The meanings of each option are:
-X file list to unzip the file, but not include the specified file file.
-V View the compressed Files directory, but do not press.
The-t test file has no damage, but does not understand the pressure.
The-D directory unlocks the compressed file to the specified directory.
-Z displays only annotations for compressed files.
-N does not overwrite files that already exist.
-O overwrites files that already exist and does not require user confirmation.
-j does not recreate the directory structure of the document, extracting all the files into the same directory.
Example 1: Unzip the compressed file Text.zip in the current directory.
$ unzip Text.zip
Example 2: Extract the compressed file Text.zip in the specified directory/TMP, if the same file exists, ask the unzip command not to overwrite the original file.
$ unzip-n text.zip-d/tmp
Example 3: View the compressed Files directory, but do not understand the pressure.
$ unzip-v Text.zip
Zgrep command
The function of this command is to look for a matching regular expression in a compressed file, using the same as the grep command, except that the object is a compressed file. If the user wants to see if there is a certain word in a compressed file, the Zgrep command is available.
Tip: When we use SSH in Windows to transfer more files to Linux, you can first use WinRAR to compress it into a zip format, and then in Linux with the unzip command to extract.
Unzip zip file into zip file under Linux