The previous article introduced the tar command of the Linux compression and decompression command. I believe that, for example, you should be familiar with the application of the tar command. Here we will continue to introduce the two Linux compression and decompression commands gzip, the zcat and bzip2 and bzcat commands are as detailed as above.
Gzip and zcat commands
[Root @ linux ~] # Gzip [-cdt #] File Name
[Root @ linux ~] # Zcat file name .gz
◆ Parameters:
-C: outputs compressed data to the screen and can be processed through data stream redirection;
-D: extract parameters;
-T: it can be used to check the consistency of a compressed file ~ Check whether the file has any errors;
-#: Compression level.-1 is the fastest, but the compression ratio is the worst.-9 is the slowest, but the compression ratio is the best! Default Value:-6 ~
◆ Example:
Example 1: Convert/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 time, man. config will become man.config.gz!
Example 2: Read the content of Example 1!
[Root @ linux tmp] # zcat man.config.gz
# The man.config.gz extracted file content is displayed on the screen !!
Example 3: Decompress the file in Example 1
[Root @ linux tmp] # gzip-d man.config.gz
Example 4: compress man. config unlocked in Example 3 with the optimal compression ratio and keep the original file
[Root @ linux tmp] # gzip-9-c man. config> man.config.gz
Bzip2, bzcat command
[Root @ linux ~] # Bzip2 [-cdz] File Name
[Root @ linux ~] # Bzcat file name .bz2
◆ Parameters:
-C: output the data generated during the compression process to the screen!
-D: extracted Parameters
-Z: Compression Parameters
-#: Same as gzip, it is used to calculate the compression ratio.-9 is the best, and-1 is the fastest!
◆ Example:
Example 1: compress/tmp/man. config with bzip2
[Root @ linux tmp] # bzip2-z man. config
# At this time, man. config will become man.config.bz2!
Example 2: Read the content of Example 1!
[Root @ linux tmp] # bzcat man.config.bz2
# The man.config.bz2 extracted file content is displayed on the screen !!
Example 3: Decompress the file in Example 1
[Root @ linux tmp] # bzip2-d man.config.bz2
Example 4: compress man. config unlocked in Example 3 with the optimal compression ratio and keep the original file
[Root @ linux tmp] # bzip2-9-c man. config> man.config.bz2
- Example: Linux compression command -- tar
- Summary all Linux compression and decompression commands
- Brief Introduction to ubantu tips you don't know
- The top 10 Linux versions in China are described in detail)
- Reasons for choosing the path to Linux Authentication