Detailed explanation of zip command in linux

zip command to compress files

parameter:

-A: Adjust executable automatic decompression files;
-b<working directory>: Specify the directory where files are temporarily stored;
-c: add a comment to each compressed file;
-d: delete the specified file from the compressed file;
-D: Do not create a directory name in the compressed file;
-f: The effect of this parameter is similar to specifying the "-u" parameter, but not only updates existing files, but if some files do not originally exist in the compressed file, using this parameter will add them to the compressed file together;
-F: Attempt to repair corrupted compressed files;
-g: Append the compressed file to the existing compressed file instead of creating a new compressed file;
-h: online help;
-i <template style>: only compress files that meet the conditions;
-j: save only the file name and its content, not any directory name;
-J: delete unnecessary data in front of the compressed file;
-k: use the file name in MS-DOS compatible format;
-l: When compressing files, replace LF characters with LF+CR characters;
-ll: When compressing files, replace LF+cp characters with LF characters;
-L: Display copyright information;
-m: After compressing the file and adding it to the compressed file, delete the original file, that is, move the file to the compressed file;
-n <suffix string>: do not compress files with a specific suffix string;
-o: The file with the latest change time in the compressed file shall prevail, and the change time of the compressed file is set to be the same as the file;
-q: Do not display the instruction execution process;
-r: Recursive processing, processing all files and subdirectories in the specified directory together;
-S: include system and hidden files;
-t <date time>: Set the date of the compressed file to the specified date;
-T: Check that each file in the backup file is correct;
-u: replace the newer file into the compressed file;
-v: Display instruction execution process or display version information;
-V: Save the file attributes of the VMS operating system;
-w: If the version number is in the file name, this parameter is only valid under the VMS operating system;
-x <template style>: Exclude eligible files when compressing;
-X: do not save extra file attributes;
-y: directly save the symbolic link, not the file pointed to by the link, this parameter is only valid under systems such as UNIX;
-z: add a comment to the compressed file;
-$: Save the volume name of the disk where the first compressed file is located;
-<compression efficiency>: The compression efficiency is a value between 1 and 9.

usage

1. Pack and compress all files in the /home/data directory into data.zip in the current directory

zip -q -r data.zip /home/data

2. If it is now in the /home directory, it is as follows

zip -q -r data.zip data

3. If it is in the /home/data directory, it is as follows

zip -q -r data.zip *

 

The above three effects are the same.

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324939804&siteId=291194637