Linux gzip, bzip2 Common compression, decompression instructions Summary __linux

Source: Internet
Author: User
Tags bz2

Linux inside the compression decompression is very commonly used instructions, and Linux support compression instructions are more diverse, and different compression using different technologies, is currently commonly used mainly gzip and bzip2 these two, some people may be more commonly used in tar this instruction, this instruction is mainly used for packaging files, Not compression, but this command supports the use of gzip and bzip2 for compression, but only when using tar alone packaging files, do not confuse.


Linux file extensions are not useful, but they are used to distinguish files, which are larger in compressed files and have a common extension:. Z. gzip bz2. tar.gz. tar.bz2.

. The z extension is compressed with compress, and the technology has been largely eliminated.

. gzip is compressed using the GZIP program.

. bZIP is compressed using the bZIP program.

Tar.gz is packed with tar and then compressed with the GZIP program.

TAR.BZ2 is packed with tar and then compressed with the BZIP2 program.


gzip directive: This command compressed file, the original file will not be retained, while Gzip compressed files in Windows can also be uncompressed, gzip instructions can extract compress compressed files.

Gzip-[option] [file_name]

Option

-C outputs the compressed data to the screen, which can be processed by data flow redirection.

-D Uncompressed Parameters

-t check for compressed files to see if there are any errors

-V Displays the compression ratio between the original file/compressed files

-# compression level 1-9, the higher the better, but also the slower, the default is 6


Gzip Uncompressed instance:



Gzip compression instance (with V's option to see compression ratio, compressed with 8 levels):



Gzip compressed file and keep original file:



In addition, Gzip compressed files if you want to view, you can use the zcat directive to view, the following is an example:



BZIP2 directive: BZIP2 is used to replace the gzip instruction, just as Gzip is replacing compress, bzip compression is better than gzip, gzip zcat View compressed files, bzip2 have bzcat.

bzip2-[option] [file_name]

-C output data from the compression process to the screen

-D Decompression Parameters

-K Keep the original file

-Z Parameters for compression

-V Display Compression ratio

-# compression level 1-9, same as Gzip


bzip2 Compression instance:



BZIP2 retains the original file compression instance:



BZIP2 Decompression instance:



Bzcat View bzip2 Compressed files:






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.