Linux packaging and decompression commands, linux packaging and decompression

Source: Internet
Author: User

Linux packaging and decompression commands, linux packaging and decompression

In linux, the following common compression formats are available: .zip、.gz).bz22.16.tar.gz#.tar.bz2.

1. zip: This format is common in linux and windows. The package format is: (zip compressed file name source file), (zip-r compressed file name source directory ).

Zip compression retains the source file. Decompress the file in the format of unzip. Decompress the package and keep the original compressed file.

2. gzip: the package format is: (gzip source file). This method compresses the file and the source file disappears (gzip-c source File> compressed file). This method retains the source file, for example, gzip-c abc> abc.gz. (Gzip-r directory) compress all the sub-files in the directory, but cannot compress the directory .? Decompression format: (gzip-d compressed file), (gunzip compressed file), (gunzip-r compressed directory ).

3. bz2: the package format is: (bzip2 source file is compressed into. bz2 format, and the source file is not retained. (Bzip2-k source file) the source file is retained after compression. Note: The bzip2 command cannot compress directories. Decompression format: (bzip2-d compressed file),-k can retain the compressed file, (bunzip2 compressed file),-k can retain the compressed file.

42.16.tar.gz(.tar.bz2): This format is actually first packaged into a tar, and then packaged into a corresponding format using the above command, in order to solve the problem that some commands cannot compress directories. Package it into tar command: (tar-cvf package file name or directory name source file or source directory),-c: Package,-v: Display process,-f: specify the name of the packaged file or directory, for example: (tar-cvf abc.tar abc) extract the tar command: (tar-xvf package file name or directory name),-x: unpack, example: (tar-xvf abc.tar ).

Command:

.Tar.gz: directly package it into the .tar.gz :( tar-zcvf compressed package name .tar.gz source file),-z: compressed into .tar.gz format. Directly decompress .tar.gz :( tar-zxvf compressed package name .tar.gz),-x: decompressed. tar.gz format.

.Tar.bz2: directly package .tar.bz2 :( tar-jcvf compressed package name .tar.bz2 source file),-j: compressed into .tar.bz2 format. Directly decompress .tar.bz2 :( tar-jxvf compressed package name .tar.bz2),-x: decompressed .tar.bz2 format.

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.