Common Compressed Files
Windows:.rar;. Zip;. 7z
Linux:.zip.;. GZ;. bz2;. XZ;. tar.gz;. tar.bz2;. TAR.XZ;
Gzip Compression Tool:
#gzip 1.txt Compression
#gzip-D 1.txt.gz decompression/gunzip 1.txt.gz Decompression
Default is Level 6
1-9 levels, 1 is the minimum scale, quickly compresses, and 9 levels is the maximum scale is very slow compression.
Gzip-level digital files
Gunzip unzip the. gz file without adding any options.
Zcat viewing Zip files for. gz
Zcat file name. gz to view the contents of the. GZ Compressed Package
-c specifies where to compress, and the original file remains
Do not add-c we compress, the original file is not visible
Decompression is the same thing
It's extracted with gunzip, if it's gzip.
Will #gzip-d-c/tmp/1.txt.gz >/tmp/d6z/2.txt
We can also change the name of the extract.
Gzip Cannot compress directory
BZIP2 Compression Tool:
Gzip and bzip2 Sometimes the compression efficiency is higher, sometimes not necessarily, but the compression algorithm is not the same.
bzip2 Files: Compressing
bzip2-d compressed files: extracting. bz2 files
You can also use the-C and gzip usages as
Cannot compress directory
Bzcat View
XZ Compression Tool:
The same XZ 1.txt is compressed, or xz-z 1.txt
Xz-d 1.txt is uncompressed/unxz 1.TXT.XZ
There is also the use of-C
Also cannot compress the directory
Zip compression tool
Install zip #yum install-y zip
#yum Install-y Unzip
Here is the command to install the Unzip zip format
zip+ file Compressed name + file
Compressed file words +-r
Decompression of the words directly decompression, but because of the compression of the source files, so when the decompression will ask whether you cover, this time to see the need to operate
Let's rm-r first remove the
And then unzip it.
It's out.
But we can't view the contents of the file
-D is the place where you put the compression
First we create a directory 1 and then specify to unzip the past
However, our compressed file names cannot be changed at the time of compression.
Tar Packaging tools
Similar to the use of zip
You can package a directory, you can package files
Example: TAR-CVF 123.tar 123/
-C Create
-V visualization (can be omitted)
-F name (must have)
Unzip the package file
#tar-XVF Tmp.tar
But not like a zip will prompt you, his extracted files will be the same name of the file to directly overwrite
TAR-TF can view the contents of a packaged file
--exclude can filter the specified file, not to pack his
Now we're filtering out d6z.
So you can filter out the d6z directory and everything underneath him, not pack it in.
Tar package and Compress
When Tar is packaged, it supports compression.
Package and compress into. gz format
-Z is. gz
-j is. bz2
-j is. XZ
The format is the same, is to add the corresponding parameters in the-CVF
If you unzip, you change C to x.
View the list of files are TAR-TF as long as it's packed and compressed.
Linux file compression and packaging