Compression Decompression Command Introduction
. GZ compression to gzip files
. bz2 compression to bzip2 file
. tar package files, merging multiple files into one directory
. tar.gz first into a tar package, then compressed to gzip file
. tar.bz2 first into a tar package, then compressed into a bzip2 file
. Tar. Z first into a tar package, then compressed to Z file
. rar
Compress to RAR file
Compressed rar a *.rar file
Unzip Unrar e *.rar
. zip
Compress to zip file
Compressing zip *.zip files
Decompression Unzip *.zip
1) gzip
Format:
gzip [-ACDFHLLNNRTVV19] [-s suffix] [--rsyncable] [name ...]
Gunzip [-ACFHLLNNRTVV] [-s suffix] [name ...]
Zcat [-FHLV] [name ...]
Example: Cannot compress the directory
gzip [-d#] File name-D decompression using # compression level 1~9,6 as default, 9 best
2) bzip2
Format:
bzip2 [-cdfkqstvzvl123456789] [filenames ...]
BUNZIP2 [-FKVSVL] [filenames ...]
Bzcat [-S] [filenames ...]
Bzip2recover filename
Example: Cannot compress the directory
bzip2 [-dz] File name-D decompression when using-Z compression is used
3) Tar
Example:
tar [-ZJXCVFPP] File name
-Z Compression with gzip
-j compression with bzip2
-X Unpacking or decompressing
-T view the files in the tar package
-C Build a tar package or compressed package file
-V Output compressed or uncompressed information
-F compression, the file name is compressed, and when decompressed, for the filename to decompress, use the-f,-f parameter in the last
-P compression preserves file attributes before compression
--exclude file or directory to exclude when file name is compressed or packaged
View a list of files for a package or compressed package
TAR-TF *.tar.gz
Package and compress into. tar.gz files
TAR-ZCVF *.tar.gz directory or file name
Unzip the. tar.gz file
TAR-ZXVF *.tar.gz
Package and compress into. tar.bz2 files
TAR-JCVF *.tar.bz2 directory or file name
Unzip the. tar.bz2 file
TAR-JXVF *.tar.bz2
. tgz
Decompression: Tar zxvf filename.tgz
Compression: Tar zcvf filename.tgz FileName
. tar.tgz
Decompression: Tar zxvf FileName.tar.tgz
Compression: Tar zcvf FileName.tar.tgz FileName
Introduction to gzip, BZIP2, zip, unzip, tar usage in Linux