1. Gzip tool does not support compression directory
Syntax: gzip [-d#] filename where # is a number 1-9, the default compression level is 6
Only files can be compressed
gzip filename generation filename.gz source file disappears
Unzip the gzip-d filename.gz and the compressed files will disappear.
2, bzip2 compression tool does not support compression directory
Syntax: bzip2 [-DZ] filename
Compression, you can add "-Z" can also not add, can be compressed files, bzip2 filename generated filename.bz2 source files disappear
Compression directory not supported
bzip2-d filename.bz2 compressed file disappears after decompression
You can use Bzcat to view the contents of bz2 files before compression
3, XZ does not support compression directory
Usage with gzip and bzip2
XZ filename
Generate FILENAME.XZ
xz-d Filename.xz extract xzcat filename View xz compressed file contents
4, Zip and unzip
Zip is a compression tool, unzip is the unzip tool
Compressed files: Zip filename.zip filename
Extract directory: Zip-r dir.zip dir/
Unzip Zip package: Unzip Filename.zip
Unzip-l Filename.zip lists the list of files in the zipped package
Unzip-d/tmp/filename.zip Unzip the package to the specified directory
5. Tar Packaging tools
You can package a directory page to package files
Syntax: tar [-ZJXCVFPP] filename
Package: TAR-CVF Test.tar test where test is a file or directory
-c means to set up the package,-V Visualization, compressed with "-F file name", the consciousness is compressed file name filename, decompression with "-F file name."
View Package Contents: TAR-TF Test.tar
-T: View the files inside the tar package
Unpacking: TAR-XVF Test.tar
-C: Extract to the specified directory, for example: Tar-c/tmp/-xvf Test.tar
Use gzip compression while packaging: TAR-CZVF 1.tar.gz 1 where 1 can be a file or directory
Use TAR-TF to view compressed packages: TAR-TF 1.tar.gz or TAR-TF 1.tar.bz2
--exclude can exclude certain files or directories while packaging
Tar--exclude 1.txt-czvf 1.tar.gz dir/
Exclude multiple files or directories: Tar--exclude 1.txt--exclude 123/-czvf 1.tar.gz dir/
This article is from the "Rhythm" blog, make sure to keep this source http://rhythm.blog.51cto.com/2800158/1629737
2015.3.27 compression and packaging of Linux documents