Linux packaging compression

Source: Internet
Author: User

    • Order
    • 1.gzip
    • 2.bzip2
    • 3.tar

Order

Compression advantages

??? 1. Save space? 2. Save Bandwidth

Solution Context

Now there are various compressed file forms, why? Compression technology is the main replacement, the compression method is not the same. Different suffixes for easy differentiation.

The earliest compression command-style compress, but it is now useless. Later issued a new generation of compression commands gzip (GNU Zip). And compression is better than the BZIP2 compression command.

Note: The above new two commands can only be compressed on a single file, and if you compress a folder what you can not. thus The packaging software is in season.

But packing is just a combination of all the programs. Did not pray for the effect of compression.

Later, the gun program, the packing box compression function together, achieve the perfect combination.

The development process of this compression,

? ? ?

Detailed


1.gzip

format:gzip [-cd#] File name

number of references :

? ? -C: Output to standard output (at this point you need to > specify the output file), and save the original file

? ? -d?: Decompression

? ? -#?: Compression level. The larger the number, the greater the compression. The longer it takes.

From 1 to 9, the default is 6

Instance:

? ? ?

? ? Using Hello is a file. With gzip Hello, the file is compressed, but the source file disappears at the same time.

How can I see the contents of a compressed file in a polygon? Able, with the Zcat command:

? ? ?

Unlock compression: gzip-d hello.gz

? ? ?

What about the compressed file that was written to the specified name again? Redirection is possible (to see if the source file is still present):

? ? ?

Different ranges of compressed files:

? ? ?


2.bzip2

format:bzip2 [-zdc#] File name

number of references :

? ? -C: Output to standard output (at this point you need to > specify the output file), and save the original file

? ? -Z?: Compression

? ? -D: Unzip

? ? -#?: compression level, the greater the number of compression, the longer the time spent.

From 1 to 9, the default is 6

Instance:

???. zip file Hello:? bzip2 Hello? (Get hello.bz2)

???? Unzip hello.bz2:? bzip2-d hello.bz2

??? compress to a file named hel.bz2: bzip2-c Hello >hel.bz2

??? To view the contents of the hello.bz2 compressed file:? bzcat hello.bz2


3.tar

format: Tar? [-cxt ZJVF] Files and folders

number of references :

? ? -C?: Create a compression create

? ? -X?: Unzip

? ? -T?: View the contents of a compressed file

? ? Note:cxf three parameters can only be used one at a time.

? ? -Z?: Package the same time gzip compression

? ? -j?: Package at the same time bzip2 compression

? ? -V?: Compression process Displays files

? ? -F?: Using File name

? ? ?? Note:the-f parameter directly adds the file name, that is, F Finally, and then no additional references.

??? -CVF Package only

Instance:

? ??? Compressed folder del?: Tar parameters? File name folder/file name after compression (can see the source file or exist)

? ? ?

???? Decompression: Enter a folder to go to, TAR-XVF compressed file:

? ? ?

? ? Compress into GZ format:

? ? ?

?

Summary : tar.gz

    • Compression: TAR-ZCVF a.tar.gz A
    • Decompression: TAR-ZXVF a.tar.gz

Linux packaging compression

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.