Zip can compress files, or you can compress directories. The compression extension is. zip.
Syntax: zip[option [compressed filename. zip][file directory name to compress]
Common options:
-R: Compresses the directory along with all subdirectories and files in the directory.
[[email protected] ~]# zip-r 111.zip 111 adding:111/(stored 0) adding:111/1.txt.gz (stored 0) [[email protected] ~] # ls111 111.txt 1.txt 222.txt anaconda-ks.cfg install.log.syslog test11111.txt 111.zip 222 333 Insta Ll.log Shell
You can see that the original file did not disappear after compression.
You can see multiple directories compressed in a single compressed file:
Example: Zip-r test.zip 111 222//Compress directories 111 and 222 to Test.zip.
-M: Delete the original file after compression.
Unzip decompression:
Unzip *.zip
Unzip test.zip-d/tmp/
Unzip the file to the specified directory.
Zip compression and Unzip decompression