Linux compression command Summary

Source: Internet
Author: User

Common Linux compression commands:
Compression tool corresponding to the extension:
*. Z: Files compressed by the compress program;
*. Bz2: Bzip2
*. GZ: Gzip
*. Tar: Tar
* .Tar.gz: the files packaged by the tar program are compressed by gzip.

The compression command can only compress and decompress a single file. As a result, each compression and decompression requires a lot of files, which is very troublesome.
In Unix-like software, the tar program can "package" many files into one file. You can even do this for directories. However, the simple tar function is only "packaging", that is, many files are combined into one file. In fact, it does not provide the compression function. Later, in the GNU program, combine the entire tar with the compression function to provide users with more convenient and powerful compression and packaging functions. Let's talk about these basic compression commands.

The compress [-DCR] file or directory is old.

Gzip [-CDT #] File Name: Decompress this file to replace compress. Therefore, you can use gzip to decompress compress files.
Zcat file name .gz: Read the compressed file content

[Samson @ yygy100428] $ LL
Total 20
-RW-r --. 1 Samson 0 05-10 21:52 DJ
-RW-r --. 1 Samson 11 05-10 hd-yygy1
-Rwxrwxr-X. 1 Samson 6933 05-10 mutex
-Rwxrwxr-X. 1 Samson 1710 05-10 mutex. c
-RW-r --. 1 Samson 28 05-10 21:52 yygy2
[Samson @ yygy 100428] $ gzip mutex
[Samson @ yygy100428] $ LL
Total 16
-RW-r --. 1 Samson 0 05-10 21:52 DJ
-RW-r --. 1 Samson 11 05-10 hd-yygy1
-Rwxrwxr-X. 1 Samson 1710 05-10 mutex. c
-Rwxrwxr-X. 1 Samson 2935 05-10 mutex.gz
-RW-r --. 1 Samson 28 05-10 21:52 yygy2

Bzip2 [-CDZ] File Name: the compressed file is in bz2 format.
Bzcat file name .bz2: Read the compressed bz2 File Content

Tar [-cxtzjvfppn] file or directory:

Tarfile and tarball: tarball are the files that are packaged and then compressed through tar, while tarfile is only packaged but not compressed. In Linux, Gzip has been integrated into tar. In sun or other older UNIX versions, tar does not integrate gzip. Therefore, if you need to decompress the file, perform the following steps:
Gzip-D testing.tar.gz
Tar-xvf testing.tar

Unlike other compression programs, Bzip2, Gzip, and compress are replaced by the original file when no special parameters are added. However, tar, both the original and later files will exist.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.