linux-Compression Decompression Command (GZIP,ZIP,TAR,BZIP)

Source: Internet
Author: User

1. Command: gzip (zip file)

Zip file suffix. gz

Ps:gzip test.txt Result: Generate file test.txt.gz, original file test.txt disappear.

Note: Only files can be compressed, the directory cannot be compressed, the original files are not preserved after compression, about 1/5 compression ratio

Decompression command: Gunzip

2. Command: Tar (packed compressed directory) strictly speaking, this command is the "pack and Go" command, which packages the directory into a *.tar file

Syntax: TAR option compressed after file name directory

Zip file suffix: *.tar.gz

Option: [-ZCVF]-C package

-V Show More information

-F specified after file name

-Z Package simultaneous compression

PS: #mkdir Japan build Japan Catalogue

#tar-ZCVF Japan.tar.gz Japan generate Japan.tar.gz Compressed files

Unzip command: Tar [options] compress file. tar.gz

[-ZXVF]-X unpacking

-V Show More information

-F specified after file name

-Z Decompression

PS:TAR-ZXVF Japan.tat.gz

3. Command: Zip (compressed file or directory)

Compressed file suffix:*. zip

Syntax: Zip [options] After compressing file name file or directory

-R Compression Directory

PS: #zip-R japan.zip Japan compression catalog Japan, generate Japan.zip file.

#zip test.txt.zip test.txt Compressed file test.txt, generate Test.txt.zip file, keep original file

Decompression command: Unzip file name

Note: After compressing the original file, the compression ratio is less than gzip.

4. Command: BZIP2 (gzip upgrade, compression ratio amazing)

Zip file suffix: *.bz2

Syntax: bzip2 [options] File

-K retains original file after compression

Ps:bzip2-k test.txt generates test.txt.bz2 file, the original file Test.txt reserved.

Packaged compressed TAR-CJVF package compressed file name directory

Unpacking and extracting TAR-XJVF files

  

-

linux-Compression Decompression Command (GZIP,ZIP,TAR,BZIP)

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.