Common compression formats in Linux
. zip. gz. bz2. tar.gz tar.bz2
Zip
Compressed files in ZIP format and Windows Universal, can be compressed/decompressed across platforms
Compression: Zip compressed file name source file
Zip-r compressed file name source directory
Decompression: Unzip compressed file
Gz
Compression: gzip source file {Compressed file compressed to GZ format, the source file disappears after compression succeeds}
Gzip-c source File > Compressed file {compressed to. gz format, source file reserved}
Gzip-r Directory {All sub-files under compressed directory, but cannot compress directory}
Decompression: gzip-d Compressed file
Gunzip Compressed Files
bz2
BZ2 Cannot compress directory
Compression: bzip2 source file {does not keep source file}
Bzip2-k source file {Keep source file}
Uncompressed: bzip2-d compressed file {-K Reserved compressed file}
Bunzip2 compressed File {-K Reserved compressed file}
tar.gz
is actually packaging the source file into a tar package, and then compressing the tar package using GZ
Compression: Tar [options] Package file name source file
Option:-C Package
-V Display procedure
-f Specifies the file name after packaging
The above three options are to package a file or directory into a tar package
-Z Compressed compressed package to tar.gz format
For example: TAR-CVF Test.tar *.txt to package the TXT document in the current directory as a Test.tar
TAR-ZCVF test.tar.gz *.txt to compress the TXT document in the current directory into test.tar.gz
Unzip: tar [options] Package file name
Option:-X Unpack the package
-V Display procedure
-f Specifies the file name after packaging
-Z Decompression
-T displays only the contents of the compressed package, but does not
Example: TAR-XVF Test.tar extract the Test.tar package
TAR-ZXVF test.tar.gz to extract test.tar.gz
tar.bz2
The difference between tar.bz2 and tar.gz is that when compressing and decompressing, the option-Z becomes-J
Organized by: MU class network (www.imooc.com)
Compression decompression of Linux