Compression decompression of Linux

Source: Internet
Author: User

Common compression formats in Linux

. zip. gz. bz2. tar.gz tar.bz2

Zip

Compressed files in ZIP format and Windows Universal, can be compressed/decompressed across platforms

Compression: Zip compressed file name source file

Zip-r compressed file name source directory

Decompression: Unzip compressed file

Gz

Compression: gzip source file {Compressed file compressed to GZ format, the source file disappears after compression succeeds}

Gzip-c source File > Compressed file {compressed to. gz format, source file reserved}

Gzip-r Directory {All sub-files under compressed directory, but cannot compress directory}

Decompression: gzip-d Compressed file

Gunzip Compressed Files

bz2

BZ2 Cannot compress directory

Compression: bzip2 source file {does not keep source file}

Bzip2-k source file {Keep source file}

Uncompressed: bzip2-d compressed file {-K Reserved compressed file}

Bunzip2 compressed File {-K Reserved compressed file}

tar.gz

is actually packaging the source file into a tar package, and then compressing the tar package using GZ

Compression: Tar [options] Package file name source file

Option:-C Package

-V Display procedure

-f Specifies the file name after packaging

The above three options are to package a file or directory into a tar package

-Z Compressed compressed package to tar.gz format

For example: TAR-CVF Test.tar *.txt to package the TXT document in the current directory as a Test.tar

TAR-ZCVF test.tar.gz *.txt to compress the TXT document in the current directory into test.tar.gz

Unzip: tar [options] Package file name

Option:-X Unpack the package

-V Display procedure

-f Specifies the file name after packaging

-Z Decompression

-T displays only the contents of the compressed package, but does not

Example: TAR-XVF Test.tar extract the Test.tar package

TAR-ZXVF test.tar.gz to extract test.tar.gz

tar.bz2

The difference between tar.bz2 and tar.gz is that when compressing and decompressing, the option-Z becomes-J

Organized by: MU class network (www.imooc.com)

Compression decompression of Linux

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.