Linux basics-compressed command gzip, bzip2, tar

Source: Internet
Author: User
*. Files compressed by the Zcompress program ;*. bz2bzip2 compressed file ;*. files compressed by the gzgzip program ;*. the data packaged by the tartar program has not been compressed. the files packaged by the * .tar.gz tar program are compressed by gzip! Ww...
*. Z compress compressed files; *. bz2 bzip2 compressed files;
*. Files compressed by the gz gzip program;
* The data packaged by the. tar program has not been compressed;
* .Tar.gz tar package files, which are compressed by gzip! At present, the common compression programs www.2cto.com are the above. Compress was the earliest version. later, GNU planned to develop a new generation of gzip to replace compress, an old-fashioned compression command, and then a bzip2 command with a better compression ratio. However, these three commands can only compress and decompress one file at a time. if I want to compress a large number of files, isn't it very troublesome? Don't worry, the role of tar will be displayed at this time, but the simple tar function is just "package" without compression. Later, in the GNU program, tar and gzip were combined. if so, more convenient and powerful compression and packaging functions were available. Www.2cto.com Next let's take a look at the usage of these commands 1. compresscompress [-d] filename-d. 2. gzip zcatgzip [-d #] filenamezcat filename.gz-d: extract parameter-#: compression level, 1 minimum compression ratio, 9 maximum, default 6
Example:

Www.2cto.com note that the original file doc is missing. Read the compressed file content: decompress:

Or

The compressed file is also missing. 3. bzip2, bzcatbzip2 [-dz] filenamebzat filename.bz2-d: extracted parameter-z: compressed parameter example: www.2cto.com. bz2 compressed file content:

Or

4. tartar [-zxcvfpP] filenametar-N 'yyyy/mm/dd "/path-zcvf target.tar.gz source-z: whether gzip attributes are simultaneously available-x: undo the parameter-t of a compressed file: view the file-c in the tarfile: Create a compressed file command-v: The file is displayed during the compression process-f: specify the compressed file name. The file name must be connected immediately after f. other parameters are not allowed!
For example, tar-zcvfP tfile sfile is incorrectly written as tar-zcvPf tfile sfile. this is correct.
Www.2cto.com-p: use the original attribute of the source file (the attribute will not be changed based on the user)-P: you can use the absolute path-N: only new files with a date later will be packaged -- exclude FILE: Do not package the FILE during the compression process. example: Package and compress

Note that the original dir Directory still exists and is not replaced. . Tar, .tar.gz, these two suffixes, are good habits. they are used to remind users whether they are compressed. from the above results, we can note that, the compressed file generated by the command with the-z parameter is small. Unpack and decompress
View the compressed file www.2cto.com-P parameters, compress and decompress -- exclude parameters, exclude files or folders that do not need to be packaged from source http://blog.csdn.net/wzzfeitian/article/details/8028480
 

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.