whether in Windows or Linux, we often see a variety of compressed files, now we need to use the decompression, in this introduction to the Linux decompression, compression commands.
Before we do the experiment, we create several files, all 100M in size, so that we can understand them more clearly.
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/00/2B/wKiom1mX80TCu2z8AAAYdzd1ows614.png "title=" 1.png "alt=" Wkiom1mx80tcu2z8aaaydzd1ows614.png "/>
One, compress "options" file(not too common, and the TAB key can not be filled)
①compress file compressed files, where we can see compress compressed files are . Z -end of the compression package.
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/9E/DB/wKioL1mX9AzTC_ErAAA8Nsrm7AM644.png "title=" 1.png "alt=" Wkiol1mx9aztc_eraaa8nsrm7am644.png "/>
②-d file extracts files, but the compressed files are lost, equivalent to uncompress
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/9E/DB/wKioL1mX9U_ThKZEAAA5pVfHX3Q918.png "title=" 1.png "alt=" Wkiol1mx9u_thkzeaaa5pvfhx3q918.png "/>
In this we can see, whether it is compression or decompression, the original files are gone, then whether I want to compress or unzip both want the original file exists, then the following is.
③-c file results output to standard output, do not delete original files
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/9E/DB/wKioL1mX9sDxhy5JAAAuEdAlZbg335.png "title=" 1.png "alt=" Wkiol1mx9sdxhy5jaaauedalzbg335.png "/>
Wow, compression after the original 100M file is only 23K, this compression is a bit fierce ah, hey, is still in the back, this is just appetizers.
④-v file is the fault visible, but generally with D, c to use.
Ii. gzip "option" File (Common, tab key can be filled)
①gzip file, you can see that gzip is a compressed file that ends in . GZ .
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/00/2B/wKiom1mX-Znwx6tZAABAQcEWQeU798.png "title=" 1.png "alt=" Wkiom1mx-znwx6tzaabaqcewqeu798.png "/>
②-d file extracts files, but the compressed files are lost, equivalent to Gunzip.
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/00/2C/wKiom1mX-i3yq9IBAABCZNEw6EY236.png "title=" 1.png "alt=" Wkiom1mx-i3yq9ibaabcznew6ey236.png "/>
③-C output to standard output for compressed or uncompressed results
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/00/2C/wKiom1mX-qzxeJXMAABGisYeq60623.png "title=" 1.png "alt=" Wkiom1mx-qzxejxmaabgisyeq60623.png "/>
The ④-v process is visible.
bzip2 "option" File (Common, tab key can be filled)
①BZIP2 file Compressed files, you can see that bzip2 is a compressed file ending with . bz2 .
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/00/2C/wKiom1mX_oGSW0cXAABE-aE228I074.png "title=" 1.png "alt=" Wkiom1mx_ogsw0cxaabe-ae228i074.png "/>
②-d unzip the file, but the compressed file is lost. Equivalent to BUNZIP2
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/00/2C/wKiom1mX_w_CbYYjAABGkXw4ay8366.png "title=" 1.png "alt=" Wkiom1mx_w_cbyyjaabgkxw4ay8366.png "/>
③-c output to standard output for compressed or uncompressed results
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/00/2C/wKiom1mX_2iSqzihAABQbfFYtys186.png "title=" 1.png "alt=" Wkiom1mx_2isqzihaabqbffytys186.png "/>
④-k keep Keep the original file.
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/00/2C/wKiom1mYACHQ3sqyAABwtsppn6o147.png "title=" 1.png "alt=" Wkiom1myachq3sqyaabwtsppn6o147.png "/>
Here, we re-A3 renamed to A3.sh, and then-K can see the compression of the original file is also in, this experiment can see that K and C will be compressed or decompressed output to the standard output exactly the same.
The ⑤-v process is visible.
⑥-# 1-9, the default compression ratio is 9, the greater the number, the higher the compression level, the smaller the file.
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/00/2C/wKiom1mYAXiTJHc0AAB5o7gJyoE466.png "title=" 1.png "alt=" Wkiom1myaxitjhc0aab5o7gjyoe466.png "/>
iv.xz "Options" file (not commonly used, can be filled with the TAB key)
①XZ file is a compressed file that ends in . XZ , and the original file is lost.
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/00/2C/wKiom1mYA0TSdyZaAABuH5MFWCI673.png "title=" 1.png "alt=" Wkiom1mya0tsdyzaaabuh5mfwci673.png "/>
②-d uncompressed, equivalent to UNXZ, the compressed file will be lost.
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/9E/DC/wKioL1mYA63Chz6vAABtArT42hs971.png "title=" 1.png "alt=" Wkiol1mya63chz6vaabtart42hs971.png "/>
③-C outputs compressed or decompressed results to standard output
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/9E/DC/wKioL1mYBBbR4iU8AAB2GKkS1SE077.png "title=" 1.png "alt=" Wkiol1mybbbr4iu8aab2gkks1se077.png "/>
④-k:keep, keep the original file and -C to output the result of compression or decompression to the standard output exactly the same.
⑤-#:1-9, compression ratio, default = 6
Summary of the law: from the above experiment can see compress, gzip, bzip2, XZ options are basically the same, the difference is the end of compression after the suffix is different, in learning to learn to be good at summing up the law, this will make you more effective.
Five, zip "options" File.zip file
①zip file.zip file is a zip that ends in . zip . Compressed in the same directory, the original file is not lost.
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/00/2C/wKiom1mYCMqxka8fAACGoMm-Zb4560.png "title=" 1.png "alt=" Wkiom1mycmqxka8faacgomm-zb4560.png "/>
②-r recursive compression.
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/9E/DC/wKioL1mYCOfwbq9GAACbaMM1HlY797.png "title=" 2.png "alt=" Wkiol1mycofwbq9gaacbamm1hly797.png "/>
③unzip decompression.
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/9E/DC/wKioL1mYCd6CndicAAC4rfD1jh0025.png "title=" 1.png "alt=" Wkiol1mycd6cndicaac4rfd1jh0025.png "/>
Vi. Tar
① -CF Create Package name original file (multiple can be specified)
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/9E/DD/wKioL1mYFzGTkl5YAAAj7aBkoIA998.png "title=" 1.png "alt=" Wkiol1myfzgtkl5yaaaj7abkoia998.png "/>
②-TF Package Name shows the file name in the package
-TVF detailed display of file names in packages
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/00/2D/wKiom1mYF73wgggUAAArNjTLDHo612.png "title=" 1.png "alt=" Wkiom1myf73wggguaaarnjtldho612.png "/>
③-RF Package Name new file name (can specify multiple) append file to compressed package, but cannot append compressed file
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/9E/DD/wKioL1mYGvShBssCAAAcfovTnlQ526.png "title=" 1.png "alt=" Wkiol1mygvshbsscaaacfovtnlq526.png "/>
④--DELETE-F Package name deleted file name (multiple can be specified)
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/9E/DD/wKioL1mYHBfi2VR5AABBYYAun6Y253.png "title=" 1.png "alt=" Wkiol1myhbfi2vr5aabbyyaun6y253.png "/>
⑤-XF Package name to extract all files to the current directory
-C unpacking to the specified directory
-V Display procedure
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/00/2D/wKiom1mYHJTxjnP9AAA0V3Vbo5M191.png "title=" 1.png "alt=" Wkiom1myhjtxjnp9aaa0v3vbo5m191.png "/>
⑥-JCF Create the package name (. tar.xz) Original file (can specify multiple) package and use XZ compression
-JCF Create Package name (. tar.bz2) Original file (can specify multiple) package and compress with bZIP
-ZCF Create Package name (. tar.gz) Original file (multiple can be specified) package and gzip compress
The above three give an example to test:
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/9E/DD/wKioL1mYHX3D4NVfAABA_ZrezoA870.png "title=" 1.png "alt=" Wkiol1myhx3d4nvfaaba_zrezoa870.png "/>
⑦-T Specifies a list that contains the files that need to be packaged, separated by a newline character
-x specifies an exclusion list, with a newline character as the interval
For example:
tar zcvf mybackup.tgz-t/root/includefilelist-x/root/excludefilelist
⑧ partition Large tar files for multiple small files:
Example: Split–b size–d tar-file-name prefix-name to separate the tar package into multiple files
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/00/2E/wKiom1mYH9ajEI78AABFCoXoUUE449.png "title=" 1.png "alt=" Wkiom1myh9ajei78aabfcoxouue449.png "/>
⑨ Merge: Multiple file names > individual filenames separated by cat
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/9E/DD/wKioL1mYIN3ibyC0AABNMSbAiYg783.png "title=" 1.png "alt=" Wkiol1myin3ibyc0aabnmsbaiyg783.png "/>
A detailed description of the compression and decompression commands commonly used in Linux