Linux compression and decompression commands (gizp, tag, zip, bzip2)
-------------------------------------- Compression and decompression command -------------------------------
* Windos can decompress all linux System File packages, but linux may not be able to decompress all of windos's
I. gzip: compressed file --- GUN zip. gz File Format
Features: 1. Only files can be compressed and directories cannot be compressed.
2. Do not retain source files
Example: gzip newfile will upload a newfile.gz file package
Gunzip: Decompress (or use gzip-d)
Example: gunzip newfile.gz
Tar: compression and decompression command
Features: Packaging directory (package the Directory into a file)
-C producer .tar package the file
-V: Show Details
-F: Specifies the compressed file name.
-Z package and compress (not supported by the old unix System)
Example: tar-zcf leyangjun.tar.gz filedir --> package filedirinto leyangjun.tar.gz
2: tar-cf newdir.tar newdir --> press it into a tar package
Gzip newdir.tar --- sit-down Compression
The above two steps are equivalent
Tar-zcvf newdir.tar.gz newdir
Ii. tar: unpack
-X unpack the .tar File
-V: Show Details
-F: Specifies the file to be decompressed.
-Z Decompression
Tar-zxf newdir.tar.gz === gunzip newdir.tar.gz --> tar-xf newdir.tar
3. zip (applicable to winds and linux)
Features: files can be compressed or directories can be compressed.
The original file is retained.
The compressed directory is added with-r
Example: zip new.zip new: compress the newfile into new.zip (this will show the compression ratio progress)
Zip-r newdir.zip newdir (compress into newdir.zip without the suffix name is also OK, add is good identification)
Unzip: Extract
Unzip newdir.zip
Iv. bzip2 (an upgraded version of gzip), all compressed files
Features: Suitable for compressing large files
-K keep source files
Example: bzip2-k newfilw2 (compress the newfile2 file and-k retains the source file)
Bunzip2:
Bunzip2 newfile2.bz2
Bunzip2-k newfile2.bz2 (source compressed files are retained)