#压缩工具
First, compress/uncompress
Compress is a long-standing compression program, after which the file is compressed, and its name is followed by a ". The extension of "Z". When you want to decompress, you can execute the uncompress instruction. In fact uncompress is a symbolic connection to the compress, so either compression or decompression can be done separately through the compress instruction.
Compress
1.1. Compression mode
Compress filename (file compression permissions unchanged, original file is missing)
compress-c filename > filename. Z original file is reserved, but permissions are set according to Umask
Shown in the example below.
1.2. Decompression method
Permissions do not change, the original file will not be retained.
uncompress filename. Z
compress-d filename. Z
When the package is in the uncompressed state, the compression package is preserved, but the permissions are set according to Umask
uncompress-c filename. Z > FileName
COMPRESS-DC filename. Z > FileName
Zcat filename. Z > FileName
Shown in the example below.
-V Compress or unzip to show detailed progress process
Second, Gzip/gunzip
Gzip is used to compress large, less-used files to conserve disk space, and there are two obvious benefits to reducing file size, which can reduce storage space and
Reduce the time to transfer when transferring files over the network.
2.1. Compression mode
gzip filename permission is not changed and the original file is missing.
Gzip-# (1-9) filename The smaller the compression speed, the lower the compression ratio; the higher the number, the slower the compression rate, the higher the compression ratio, the resulting
The smaller the compressed file, the default compression ratio is 6. For example.
gzip-c filename > filename.gz original file reserved, but permissions are set according to Umask (similar to compress)
2.1. Decompression method
Permissions unchanged, original file is missing
Gunzip filename.gz or gzip-d filename.gz permissions unchanged, the original file is missing. Examples are shown.
The original file is reserved, but the permissions are set according to Umask
Gunzip-c filename.gz > FileName illustration for example.
GZIP-DC filename.gz > FileName
Zcat filename.gz > FileName
Third, bzip2
bzip2 Command The compression package for creating and managing (including extracting) ". bz2" formats is larger than compress, gzip, and is more compressed compared to plain text files.
3.1. Compression mode
bzip2 filename permission unchanged, original file disappears
-k filename permission does not change, the original file is retained, the command can also be used when extracting.
-# (1-9) filename The smaller the compression speed and the lower the compression ratio; the higher the number, the slower the compression rate and the higher the compression ratio.
The smaller the resulting compressed file, the default compression ratio is 9. (similar to gzip)
-C filename>filename.2 Original file is reserved, but permissions are set according to Umask
3.2. Decompression method
Bunzip-k filename.bz2 or BZIP2-KD filename.bz2 permissions do not change, compression packet retention
-C filename.bz2 > FileName Original file retention, permission change
-DC filename.bz2 > FileName permission reserved, original file also reserved
Bzcat filename.bz2 > FileName compression package reserved, but permissions are set according to Umask
Iv. XZ
A new compression tool is more convenient and useful, with the extension ending in XZ.
4.1. Compression mode
XZ filename permission unchanged, original file disappears
xz-k filename permission unchanged, original file reserved, usable in compression and decompression
The smaller the XZ-# (1-9) filename, the faster the compression, the lower the compression ratio, the greater the number, the slower the compression, the higher the compression ratio, and the more
The smaller the compressed file, the default compression ratio is 6.
xz-c filename > Filename.xz original file reserved, but permissions are set according to Umask
4.2. Decompression method
The permissions are not changed, the compression package is preserved
Unxz-k filename.xz or XZ-KD filename.xz
Unxz-c filename.xz > FileName
XZ-DC filename.xz > FileName
The compressed package is reserved, but the permissions are set according to Umask
Xzcat filename.xz > FileName
#打包工具
Packaging refers to a large number of files or directories into a total file, compression is a large file through some compression algorithm into a small file.
Five, zip
zip command can be used to unpack files for packaging operations. Compressed files with a ". zip" extension are generated after the file has been compacted .
Package format: Zip-r file name to be packaged (-R for recursion)
decompression Format:unzip the package name to unpack
For pipeline decompression method, not the focus, can be understood.
Vi. Tar
tar command You can create archives for Linux files and directories. With tar, you can create files (backup files) for a specific file, or you can change the file in the archive, or
Add a new document to the file. Package a large number of files and directories into a single file, which is for backing up files or combining several files into one file for easy network transmission
is very useful.
-C Create Package
-V package or unpack the display process
-F Specify File
-T view the contents of the package
-X Unpack the file from the package to unlock the specified file or all files
-XF Package name to extract the file name
-XF package name to solve all the files
Packaged-CVF combined use
View the contents of the package with the-t option.
-R adding files to the archive package
--delete deleting files from an archive package
-C with-X mates, specify the destination directory to extract to
-j using bzip2 when compressing and decompressing
-Z Compression and decompression using gzip
-j using XZ when compressing and decompressing
Example combination BZIP2 Implementation one step package and compress, tar jcvf file name. tar.bz2 files that need to be packaged, such as.
Tar jxvf
Tar zxvf
Tar jxvf directly with tar xvf
Tar more intelligently specify the packaging method with bzip2 before adding-j,gzip when the tar parameter plus-Z, with the XZ when the Tar property false-j, in order to facilitate the use of direct tar XVF
Linux Compressed Packaging archive