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: