Linux file compression and packaging introduction
- 2020-12-18 01:59:45
- OfStack
1. Introduction to compression packaging
Common compressed files
windows .rar .zip .7z
Linux .zip, .gz, .bz2, .xz, .tar.gz, .tar.bz2, .tar.xz
gzip compression tool
Examples of ES14en. gzip and ES16en-ES17en
In the following example, you can see that the actual unzipped size after compression changed from 1.6M to 1.3M with the same number of rows
Gzip -# indicates compression level 1.txt (range 1-9, default 6 enhanced from 1 to 9)
zacat 1.ES29en.gz is the command to view the compressed file. The operation procedure is to unzip and then view
gzip -c 1.txt > root/ 1.txt. gz means to unzip 1.txt to root and keep the original 1.txt file
bzip2 compression tool
Compared with gzip, the compression strength is higher and the algorithm is different. The higher the compression strength, the more resources will be consumed by cpu. The default level specified by bizp is 9
Note that the example below demonstrates that the compressed file can be changed to another name. If you are prompted to look at the txt file for base 2, use file to look at the file first
xz compression tool
It is not commonly used, but it can be encountered in tar bag. tar. xz, the compression strength is stronger than bzip
zip compression tool
zip features compressed original files without deletion
zip's compressed package is unable to view the content, and can only view the list of files through ES71en-ES72en instead of the content
tar packaging tool
Is more commonly used on Linux tar tools, tar originally just a packaging tools, only 7 z, was also realized with gzip, xz, bzip2 tools such as support, the compression tools themselves can only realize the file or directory (separate compressed files) in a directory of compression, no implementation of packaged compressed file, so we also no need to separate to learn several other tools, tar decompression and compression are with a command, just different parameters, use more convenient.
Packaging doesn't change the size of the file too much. The goal is to consolidate all types of files into one large file for easy transfer
tar-tf ES92en. tar view the list of files, equivalent to ES94en-ES95en
Package and compress, unpack and uncompress