Compress (ZIP) and decompress (unzip) commands in centos

Source: Internet
Author: User

During website migration, too many files in the website directory will consume a lot of time, so we need to use the compression and decompression commands, such as, I need to back up the/home/wwwroot folder, however, because wwwroot contains tens of thousands or even more files, you need to use the zip command to compress the wwwroot file and then transfer it:

CD/wwwroot

Zip-r wwwroot.zip wwwroot

OK ,the wwwrootfile is compressed into the wwwroot.zip format, which is uploaded and downloaded quickly. Similarly, when uploading a compressed file to centos, You can decompress the file using unzip. For example, to decompress/home/wwwroot.zip, run the following command:

CD/home

Unzip wwwroot.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

Http://liuzhichao.com/p/681.html

Related Article

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.