Compression decompression tool under Linux (reproduced)

xiaoxiao2021-03-06  36

First, Linux Compression Tool Overview

In the Linux system, many compression tools are provided, although convenient, it is inevitable to cause some confusion. Through a period of finishing, the author will reason, hoping to help everyone: First, let's take a look at the "Compressed Pack Extension and Compression Tool Correspondence Table", everyone knows this table Online downloaded compressed packs, what software is used to solve it. Tool name Compression Pack Extension Gzip / Gunzip ".gz" compress / uncompress ".z" zip / unzip ".zip" bzip2 / bunzip2 ".bz2" LHA ".lzh" Next, we pass instances to measure them Compression efficiency and performance:

Test 1: Test data: Source file is a database file, its size is 5,244,928; test results: Gzip: 19,136, 2 seconds compress: 17,769, 1 second zip: 19,261, 2 second bzip2: 1902, 2 seconds test 2: Test data : The source file is a TAR package of a / etc directory, which is 2,631,680; test results: Gzip: 551,736, 2 seconds compress: 877, 391, 3 seconds zip: 551, 856, 3 seconds BZIP2: 478, 512, 11 second test three: test data: The source file is an AVI video file, which is 23, 157,760; test results: gzip: 17, 151, 395, 43 seconds compress: compression failed, 43 seconds zip: 17, 151, 509, 42 seconds BZIP2: 16, 587, 991, 2 minutes 40 seconds through the above experiment, I think I think If you need a high compression ratio, choose BZIP2; otherwise the best choice is Gzip, its cost is better, and it is a pure free software: gzip is GNU Zip! Under the Linux / UNIX system, use these compression software to pack a directory directly. When you need to do this, you usually use TAR to archive, package the entire directory into a TAR package, then compressed with compression software. Below we take all the files in the backup / etc directory, explain: TAR-CVF etc / etc / etc (will generate an etc .tar in the current directory) Gzip etc.tar (will compress Etc.tar into etc.tar) .gz) About TAR's more information, we will explain themselves. Ok, I said so much, let's take a look at the usage of these compression tools together.

Second, Linux Compression Tool Overview

1.Gzip and Gunzip compression package extensions: ". GZ" Features: 1) It is a pure free software, good performance! 2) If no parameters are added, after generating a compressed file, the original file will be deleted; command use: 1) Compress a file: Gzip file will generate file.gz, delete the original file file; 2) Compress a file and retained Source file: gzip -ca> A.GZ3) Improve compression ratio: gzip -9 file Note: The compression level can be from 1-9, the larger the compression effect, but the longer the time to spend, the default is 6 .4) Decompression: gzip -d file.gz or gunzip file.gz5) Display details: gzip -v file6) Display version information: gzip -v2.bzip2 and bunzip2 Compression package extensions: ". BZ2" Features: 1 It adopts a new compression algorithm, compression effect is better than traditional LZ77 / LZ78 compression algorithm; 2) If no parameters are added, after generating compressed files, the original file will be deleted; command use: 1) Compress one File: BZIP2 file will generate file.bz2, delete the original file file; 2) Compress a file and reserve the source file: bzip2 -k file 3) Improve the compression ratio: bzip -9 file Note: Compression level can be from 1-9 The larger the number, the better the compression effect, the longer the time to spend. 4) Decompression: bzip2 -d file.bz2 or bunzip2 file.bz25) Show details: bzip2 -v file6) Display version information: bzip2 -v Related Tools: If you use bzip2 compressed file error, you can try to use BZip2Recover To recover: bzip2recover file-bad.bz2

3. Compress and Uncompress Compressed Package Extensions: ". Z" Features: 1) It is a historic compression program that can be found in many UNIX systems; 2) After generating compressed files by default, it will delete the original file. Command use: 1) Compress a file: compress file2) Compress a file and reserve the source file: compress -ca> a.z3) Improve the compression ratio: compress -b9 file Note: The compression level can be from 9-16, the larger number The better the compression effect, the longer it takes. The preset value is 16.4) Decompression: compress -d file.z or uncompress a.z5) Show details: compress -v file6) Display version information: Compress -V

4. ZIP and UNZIP Compressed Pack Extensions: ". Zip" Features: 1) It is a wide compression program whose version spans more than 10 operating systems and hardware structural platforms; 2) By default, generate compressed files The original file will not be deleted. Command use: 1) Compress a file: Zip zipfile file (zipfile is a compressed file name, file name to compress file name) 2) Compress a file and delete the source file: zip -m file3) Improve the compression ratio: zip - 9 File Note: The compression level can be from 1-9, the larger the compression effect, the longer the time to spend. The preset value is 6.4) Decompression: zip -d file.zip or unzip file.zip5) Show details: zip -v file6) Display version information: Zip -V Related Tools: In Linux, it also provides one Call Zipinfo tools to see more information about Zip compressed files: Zipinfo file.zip, other compression / decompression tools

In addition to these four pairs of compressed / decompressed tools, there are three compressed / decompression tools under Linux:

1.LHA LHA is a compression program that is evolved from Lharc. After it is compressed by it, it produces an extension of ".lzh". It is also relatively simple, and it is possible to pack a directory: 1) Compress a file: Lha -a lhzfile file (LHzFile is the compressed file name, file name to be compressed) 2) Unzip: Lha-xiw = / tmp lhzfile (where / tmp is the decompressed storage directory, lhzfile is a compressed file name) 3) Compressed a directory: LHA-A LHZFILE DIRECTORY

2.Gzexe This is a very special compression tool that is used to compress the executable. When you execute the executable compressed by Gzexe, the file will automatically decompress the execution, and the same as executing a general executable. Of course, this process will take more system resources, and only your available disk space is not recommended. 1) Compress GZEXE Program will generate a program ~, for the case of the compression failure can also recover, when you are determined after being compressed, you should delete it, otherwise it does not compress it? 2) Unzip GZEXE -D Program

3.Unarj If you have some packages with an ARJ compressed package, you can use UNARJ to unlock it, but it can only be solved, but it cannot be executed. ARJ compression tool is not available in Linux. Decompression, it is simple: Unarj e Arjfile

转载请注明原文地址:https://www.9cbs.com/read-60226.html

New Post(0)