Linux in tar. GZ bz2 XZ How to use decompression

Source: Internet
Author: User
Tags bz2 unpack

tar.gz/xz/bz2 How to Decompress

Tar usage: Tar was originally used to package on tape drives, and now tar can package any file, package multiple files and directories into a single file, and also support xz/bzip2/gzip compression, separate tar does not have the function of compression, in the packaging and also want to compress, must be used with the compression parameters

tar [parameters] [options]

1.-V Displays the processed files in detail, displaying the file names processed

2.-F followed by the file or directory to be processed, that is, package and package file name This option is required in general, it is recommended to write this parameter separately

3.-C Create a new package file

4.-X unpack or unzip, unzip with options like-Z j

5.-Z to package or unpack bZIP compressed package, file name is *.tar.gz

6.-j or unpack the XZ compressed package, the file name is *.TAR.XZ

7.-j Pack or unzip the BZIP2 compressed package and ask for the name *.tar.bz2

8.-Z to package or unpack compress compressed package, file name *.tar. Z because the compress efficiency is not high, now basically discarded no

9.-T displays the file name in the package file

Add new files to the already-punched package

One.-P preserves the properties and permissions of the original file

12-P reserved absolute path in file

13-c specifying the unpacking to a specific directory

14-a Merging multiple archive packages

Description

Where-f option specifies the destination file to be packaged or unpacked tar, unpacking must be selected, packaging if default, the system default output to the standard output, that is, if the screen is not a plain text file may appear that garbled, or unexpected error, packaging If you do not specify the-f option, you can also use file flow redirection >

such as: Package testa testb files into Test.tar

TAR-CV Testa testb> Testa.tar

And the-F option must follow the file, than packaging Testa must be written TAR-CVF Test.tar Testa cannot be written tar-cfv Test.tar Testa, but can be written tar-cvf Test.tar testa because parameters can be To merge, just suggest that the-F option be written separately, just make sure the-f option is immediately followed by the file.

1. Packaging Multiple files tar [option parameters] destination file is packaged file

Tar-cv-f Test.tar Testa Testb  

  

2. Unpack the package tar in 1 [option parameters] the unpacked package

Tar-xv-f Test.tar  #解压到当前目录tar-xv-f test.tar-c/tmp/mydir# unpacking test.dir into/tmp/mydir directory

3. View the file name in the TAR package

Tar-tv-f Test.tar  #查看test all file names in tar tar-tzv-f test.tar.gz# view  all file names in test.tar.gz

4. Package at the same time with the XZ bzip2 gzip compression into, if decompressed, C to X can be

Tar-cjv-f test.tar.xz Testa testb  #将 Testa testb packaged with XZ compressed into test.tar.xztar-xjv-f test.tar.xz #解压 TEST.TAR.XZ when the current target Tar-cjv-f test.tar.bz2 Testa testb# testa testb into baip2 teste.tar.bz2tar-xjv-f #将 test.tar.bz2 Solution Press to current directory tar-czv-f test.tar.gz Testa testb #将 Testa Testb packed with gzip compressed into test.tar.gztar-xzv-f test.tar.gz #将 test.tar.gz Solution Press to current directory tar-czv-f test.tar.z Testa testb #将 Testa Testb packed with compress compression test.tar.ztar-xzv-f test.tar.z #将 Test.tar.z Decompression To the current directory

  

5. Add a new file to an existing package

Tar-rv-f Test.tar TESTC #将testc添加到test. Tar Package


6. Merge multiple packages, the merged package is the first package

Tar-va-f Test1.tar test2.tar test3.tar #将 test1.tar Test2.tar Test3.tar merged into the first package Test1.tar this time Test1.tar contains test1 test2 test 3 of these three files

  

Linux in tar. GZ bz2 XZ How to use decompression

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.