Centos compression and packaging, Centos compression and packaging
This is basic knowledge, but some things are like this. If it is useless for a long time, it will be forgotten. In the past, there was a bad habit of not taking notes, after learning something, you must record it in your blog so that you can check it from time to time.
In the computer world, the expression of data is only 0 or 1, and the compression algorithm is to find some algorithms based on these 01, which can be represented by fewer 01.
In linux, the most popular types of compression are bzip2 (Suffix: bz2) and gzip (Suffix: gz). Because these compression tools are used separately, each file is compressed, therefore, a packaging tool will be used together.
Gzip and zcat
Gzip command parameters:
-C: outputs compressed data to the screen, which can be processed through data flow guidance.
-D: extracted Parameters
-T: can be used to check the consistency of a compressed file to see if the file is incorrect.
-V displays the compression ratio of the original file/compressed file.
-# Compression level:-1 is the fastest, but the compression ratio is the worst.-9 is the slowest, but the compression ratio is the best. The default value is-6.
If we need to view the content, we can directly use the zcat command
Bzip2 and bzcat
In fact, bzip2 replaces gzip, and the compression efficiency is higher than that of gzip. So we will use this technology as a priority in the future. After all, the better technology will be used earlier, fast promotion.
I think the command parameters are similar, but they are more specific. You need to compress the command or decompress the command to determine whether to delete the original file.
-C: The same as gzip
-D: extracted Parameters
-K: Keep the source file without deleting the original file.
-Z: Compression Parameters
-V: displays the compression ratio of the source document/compressed file.
-#: Same as gzip
View content in bzcat
Tar commandThe files are compressed separately, but for those large directories, We Need To package them first and compress them.
-C: Compression Parameters
-X: extracted Parameters
-J: bzip2
-Z: gzip
-V: displays the file name being processed during processing.
-F: Specifies the file name.
-T: view the file names contained in the package., Focus on viewing the file name
-C: This option is used for decompression. If you need to specify the compression location, you can use this parameter.
-P: retains the original permissions and attributes of the backup data. It is often used to back up important configuration information.
-P: the absolute path is retained (because we generally do not include the absolute path during backup. If we use the absolute path, during decompression, the new configuration file will be overwritten)
Here for demonstration, the v parameter is not added, and bzip2 is OK if the z parameter is changed to j,
The-t parameter allows you to view the files in the file:
Basic names: tarfile and tarball
Tarfile indicates that the package is directly packed using the tar command, but not compressed. tarfile indicates that not only the package is compressed