Compression and decompression of zip files under linux

888u

Last update at :2024-05-13,Edit by888u

One, compression

The basic usage of the linux zip command is:

zip [parameters] [packed file name] [packed directory path]

linux zip command parameter list:

-a Convert the file to ASCII mode -F attempts to repair damaged compressed files -h Display help interface -m After compressing the file, delete the source file

-n specific string Do not compress files with specific suffix strings -o Set the latest change time of all files in the compressed file to the time of compression -q Quiet mode, does not display the execution process of instructions during compression -r Process all subdirectories and files in the specified directory together -S includes system files and implicit files (S is uppercase) -t date Set the last modification date of the compressed file to the specified date, and the date format is mmddyyyy

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 following is the compressed relative path directory

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

Unzip:

unzip command

Syntax: unzip [option] compressed file name.zip

The meaning of each option is:

  -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 show comments for compressed files.

 -n Do not overwrite existing files.

-o Overwrites existing files without requiring user confirmation.

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

Example 1: Decompress 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

Recommended site search: foreign virtual host, cm domain name, server proxy IP, dual-line server hosting, European server, check your own IP, vps virtual host, Ministry of Industry and Information Technology filing, mobile server rental, Taiwan server,

Compression and decompression of zip files under linux

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码