Compress (zip) and decompress (unzip) commands in Centos
When using ftp to back up data, it takes a lot of time because there are too many files, so we need to use the compression and decompression commands, for example, I need to back up the/opt/data folder, however, since there are tens of thousands of files in data, you need to use the zip command. For details, see data File compression before transmission:
Cd/opt
Zip-r data.zip data
OK ,compress the datafile into the data.zip format, which is very fast for uploading and downloading. In the same way, when you upload the compressed file to centos, you can use unzip to decompress the file. For example, run the following command to decompress/opt/data.zip:
Cd/opt
Unzip data.zip
====================================
More related commands are as follows:
1. I want to compress a file abc.txtand a directory dir1into yasuo.zip:
# Zip-r yasuo.zip abc.txt dir1
2. I downloaded a yasuo.zip file and want to decompress it:
# Unzip yasuo.zip
3. I have abc1.zip, abc2.zip, and abc3.zip under the current directory. I want to decompress them together:
# Unzip abc \?. Zip
Note :? Represents a single character. If "*" is used, it indicates any number of characters.
4. I have a large compressed file large.zip. I don't want to decompress it. I just want to see what it contains:
# Unzip-v large.zip
5. I downloaded a compressed file large.zip and want to verify whether the downloaded file is complete.
# Unzip-t large.zip
6. I used -v8.0 to find that there are many directories and subdirectories in the music.zip compressed file, and the subdirectories are actually mp3 files. I want to download these files to the first-level directory instead of the first-level directory:
# Unzip-j music.zip