Compression and decompression in the Linux operating system,. zip,. tar,. tar.gz,. tar.bz2,. Tar.xz,. jar,. 7z, etc.

Source: Internet
Author: User

Zip format

Compression: Zip-r [ target file name ]. zip [ original file/directory name ]

Decompression: Unzip [ original filename ]. zip

Note: the-r parameter represents recursion

Tar format (this format is only packaged, not compressed)

Package: TAR-CVF [ target file name ]. Tar [ original filename/directory name ]

Unpacking: TAR-XVF [ original filename ]. Tar

Note: The C parameter stands for Create (created), the x parameter represents extract (unpacking), the V parameter represents verbose (details), the f parameter represents filename, so f must be followed by the file name.

tar.gz format

Method One: Using the previously packaged tar file, use the compression command directly.

Compression: gzip [ original filename ]. Tar

Decompression: Gunzip [ original filename ]. tar.gz

Mode two: one-time packaging and compression, decompression and unpacking

Package and Compress: TAR-ZCVF [ target file name ]. tar.gz [ original filename/directory name ]

Unpack and unpack: tar-zxvf [ original filename ]. tar.gz

Note: Z represents compression/decompression using the GZIP algorithm.

tar.bz2 format

Method One: Use the already packaged tar file to execute the compression command directly:

Compression: bzip2 [ original filename ]. Tar

Decompression: bunzip2 [ original filename ]. tar.bz2

Mode two: one-time packaging and compression, decompression and unpacking

Package and Compress: TAR-JCVF [ target file name ]. tar.bz2 [ original filename/directory name ]

Unpack and unpack: tar-jxvf [ original filename ]. tar.bz2

Note: Lowercase j represents compression/decompression using the BZIP2 algorithm.

Tar.xz format

Method One: Using the packed tar file, use the compression command directly:

Compression: XZ [ original filename ]. Tar

Decompression: Unxz [ original filename ]. tar.xz

Mode two: one-time packaging and compression, decompression and unpacking

Package and Compress: TAR-JCVF [ target file name ]. TAR.XZ [ original filename/directory name ]

Unpack and unpack: tar-jxvf [ original filename ]. tar.xz

Note: Capital J represents compression/decompression using the XZ algorithm.

tar. Z Format (OBSOLETE)

Method One: Using the packed tar file, use the compression command directly:

Compression: Compress [ original filename ]. Tar

Unzip: uncompress [ original filename ]. Tar. Z

Mode two: one-time packaging and compression, decompression and unpacking

Package and Compress: TAR-ZCVF [ target file name ]. Tar. Z [ original filename/directory name ]

Unpack and unpack: tar-zxvf [ original filename ]. Tar. Z

Note: Capital Z represents compression/decompression using the ncompress algorithm. In addition, ncompress is the compressed format of the early Unix system, but because of the ncompress compression rate is too low, is now obsolete.

Jar format

Compression: JAR-CVF [ target file name ]. jar [ Original file name/directory name ]

Decompression: JAR-XVF [ original filename ]. jar

Note: If you are packaging a Java class library and the main class exists in the class library, you need to write a meta-inf/manifest. MF configuration file with the following content:

manifest-version:1.0

CREATED-BY:1.6.0_27 (Sun Microsystems Inc.)

Main-class:the_name_of_the_main_class_should_be_put_here

Then package it with the following command:

JAR-CVFM [ target file name ]. Jar Meta-inf/manifest. MF [ original filename/directory name ]

This will enable you to run the public static void Main method in the main class directly with the "Java-jar [filename].jar" command.

7z format

Compression: 7z a [ target file name ]. 7z [ original filename/directory name ]

Extract: 7z x [ original filename ]. 7z

Note: This 7z decompression command supports RAR format, i.e.:

7z x [ original filename ]. rar

Compression and decompression in the Linux operating system,. zip,. tar,. tar.gz,. tar.bz2,. Tar.xz,. jar,. 7z, etc.

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.