InWindowsThe compressed files that we touch most. rarFormat of the。but in Linux , such a format is not recognized, it has its own unique compression tools . But there is a file that can be used under Windows and Linux that is the . zip format . the advantages of compression do not need to introduce the author believe you know it, it can not only save disk space and in the transmission of time can also save network bandwidth .
InLinuxThe most common compressed files are usually. tar.gz is the end, besides . Tar,. GZ,. bz2,. zip, and more . in the past also introduced the Linux system suffix name actually do not matter, but for the compressed file must take . this is to determine the compression file is compressed by which compression tool, and then to the correct decompression of the file . The following describes the compression tools for common suffix names .
. GZ gzip Compression tool compressed Files
files compressed by the . bz2 bzip2 Compression Tool
. Tar tar Packager package Files (tar does not compress function, just merge a directory into one file )
The. tar.gz can be understood to be packaged with tar first and then gzip compressed
. tar.bz2 Ibid, first packaged with tar , then bzip2 compressed
"Gzip"
Syntax: gzip [-d#] filename where # is the number of 1-9
-D : Use when extracting
-# : Compression level,1 compression worst,9 compression Best,6 default
After compressing the test.txt , it becomes the test.txt.gz
Unzip with-D
Note thatgzip is not allowed to compress the directory
"Bzip2"
Syntax:bzip2 [-dz] filename
-D : Unzip
-Z : Compression
In fact , the-Z parameter can be omitted, you may wish to try
similar to gzip decompression, but also with- D decompression .
"Tar"
Syntax:tar [-ZJXCVFPP] filename
-Z : whether to compress with gzip at the same time
-j : Whether to compress with bzip2 at the same time
-X : Unpacking or decompressing
-T: view The files inside the tar package
-C : Build a tar package or zip file package
-V : Visualize
-F: followed by file name, compressed with -ffilename, decompression with -f filename, meaning unzip filename. Note that if there are multiple parameter combinations with -f please put f
-P : Use the properties of the original file to compress what properties to compress before compressing what properties . (not commonly used)
-P: Absolute path can be used . (not commonly used)
--exclude filename : Do not include the filename file when packaging or compressing . (not commonly used)
First inTestSet up under Directorytest111directory, and then intest111Set up under DirectoryTest2.txt and write to test2.txttar packaged into test111.tar.
Delete the original test111 directory, and then unpack the Test111.tar, whether packaged or unpacked, the original file is not deleted .
Use gzip compression while packaging
Use -tf and Baonilai to see what files are in the package or package
Remove the test111 First, then use tar-zxvf to decompress the. tar.gz Compression Pack .
-JCVF is packaged with bzip2 compression,-TF can also view . tar.bz2 Compression packs
-JXVF unzip . tar.bz2 Compressed Package
the role of the--exclude parameter is to filter out some files when packaging, if you want to filter more than one file
Can only be continued with --exclude filename .
Linux Getting Started tutorial (10) document compression and packaging