Get the App
SLTechnology News&Howtos  ›  Servers  › 

The realization method of decompression of Bzip2 Command under Linux

Shulou Source: shulou.com Published: 2022-06-01 16:51:16 09月16日 Update

This article introduces the relevant knowledge of "the implementation of Bzip2 command decompression under Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Gzip, zcat command

[root@linux ~] # gzip [- cdt#] file name

[root@linux ~] # zcat file name .gz

◆ parameters:

-c: output the compressed data to the screen, which can be processed through stream redirection

-d: parameter for decompression

-t: can be used to check the consistency of a compressed file ~ to see if there are any errors in the file

-#: compression level,-1 is the fastest, but the compression ratio is the worst and-9 is the slowest, but the compression ratio is *! The preset is-6 ~

◆ example:

Example 1: copy / etc/man.config to / tmp and compress it with gzip

[root@linux ~] # cd / tmp

[root@linux tmp] # cp / etc/man.config.

[root@linux tmp] # gzip man.config

# at this point, man.config becomes man.config.gz!

Example 2: read out the contents of the file in example one!

[root@linux tmp] # zcat man.config.gz

# the contents of the unzipped man.config.gz file will be displayed on the screen!

Example 3: decompress the file of example 1

[root@linux tmp] # gzip-d man.config.gz

Example 4: compress the man.config extracted from example 3 with a compression ratio of * * and keep the original file

[root@linux tmp] # gzip-9-c man.config > man.config.gz

Linux Bzip2, bzcat command

[root@linux ~] # bzip2 [- cdz] file name

[root@linux ~] # bzcat file name .bz2

◆ parameters:

-C: output the data generated by the compression process to the screen!

-d: parameter for decompression

-z: compressed parameter

-#: same as gzip, the parameters of compression ratio are calculated.-9 * *,-1 is the fastest!

◆ example:

Example 1: compress the / tmp/man.config in bzip2

[root@linux tmp] # bzip2-z man.config

# at this point, man.config becomes man.config.bz2!

Example 2: read out the contents of the file in example one!

[root@linux tmp] # bzcat man.config.bz2

# the contents of the unzipped man.config.bz2 file will be displayed on the screen!

Example 3: decompress the file of example 1

[root@linux tmp] # bzip2-d man.config.bz2

Example 4: compress the man.config extracted from example 3 with a compression ratio of * * and keep the original file

[root@linux tmp] # bzip2-9-c man.config > man.config.bz2

This is the end of the content of "the implementation of Bzip2 command decompression under Linux". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Example file content parameter command screen data output method fastest original more knowledge process practical worst consistent learned and then consistent. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn macOS Xiaomi Apple OPPO Reno