For beginners, there is only one source file for Linux compression commands. This means that before compression, You Have To package all the files to be compressed into one package, and then compress the package, to Compress multiple files. Therefore, you must first understand the packaging command before understanding how to decompress the package. Linux packaging is generally completed through the tar command. man tar can be used to obtain some information. tar is used to complete different operations by specifying different parameters, the two parameters -- x/c are usually used. The literal meanings of these two parameters are c -- create, x -- extract, create and subcontract extraction, and there are also some uncommon parameters, for example, a adds tar to the end of another tar package, t, lists the files in the package,-C, and switches the working directory to the specified directory, by specifying this parameter, you can place the decompressed file to the specified directory. Another important parameter, f, can be packaged in a file. The following two simple examples illustrate packaging and subcontracting extraction: emerge-cf file.tar file1 file2 file3-c, packaging mode,-f specifies the packaging result to be created to store the file. 2.unpack the file. Now there is a package of file.tar. Tar-xf file.tar-x: unpack mode.-f specifies the tar package file. After packaging, the compression and compression functions are uncertain. Once a transaction becomes simpler, all operations will be simpler. There are several methods to compress Linux, they are gzip compression, bzip2 compression, and xz compression. Because decompression and compression are not the focus of this article, we will not focus on some parameters, but will briefly introduce them when necessary. 1. use gzip to compress: gzip file.tar (if you want to compress the file to a specified file, you can use "gzip-c file.tar> xxx" to decompress the file, as shown below: gunzip-c file.tar.gz> xfile.tar 2. compress With bzip2: bzip2-c file.tar> xifle.tar.bz2 unzip: bunzip2-cv xfile.tar.bz2> xfile.tar 3. compress With xz: xz-c file.tar> xfile.tar. unxz-c xfile.tar. xz> xfile.tar for compression, the compression ratio is obviously the primary concern. In terms of compression ratio, xz> bzip2> gzip can generally be 15% higher than bzip2, the compression rate is 30% higher than that of gzip, but there are some other things that need to be concerned in specific situations, such as CPU usage. Although the compression ratio of xz is high, it The time consumed is the most, which means that more CPU time slice is occupied. Therefore, when selecting the compression algorithm, we should also consider the current primary focus, so as to choose the compression algorithm. The packaging and decompression processes are described above, but these two processes are separated. Normally, these two processes are not separated, instead, use the tar package to package and compress multiple files into one compressed package. The following uses the tar command to call these three compression methods to compress multiple files into one compressed package. 1. use tar to call gzip to generate the compressed package tar-czvf file.tar.gz file {1, 2, 3} 2 for file1, file2, and file3. use tar to call bzip2 to generate the compressed package tar-cjvf file.tar.bz2 file {1, 2, 3} 3. use tar to call xz to generate the compressed package tar-cJvf file.tar for file1, file2, and file3. xz file {1, 2, 3} is a bit worth noting for the above text, that is, the suffix name is not a must, and the suffix name in Linux is not a must, this should be a basic point, the reason why suffix names are specified is to facilitate differences and some rough identification programs. After reading the above text, I believe that we should have a certain degree of understanding of Linux compression. In fact, the most important thing is to learn to read man pages. There is everything in it, but it will be too complicated if it is too full, not suitable for beginners.