Compress (zip) and decompress (unzip) commands in Centos

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.