Linux command: Tar

Source: Internet
Author: User
Tags rar

1, Command introduction:

Tar is used to package, compress and decompress files.

2. Command format:

tar [options] File

3. Command parameters:

The necessary parameters are as follows:

-A add compressed file to existing compression

-B Set Chunk size

-C Create a new compressed file

-D Record File differences

-R Add a file to a file that has been compressed

-u add changed and existing files to a compressed file that already exists

-X extracting files from compressed files

-T displays the contents of the compressed file

-Z Support gzip unzip files

-j Support bzip2 Extract files

-Z Support Compress unzip files

-V Show Operation procedure

-L File System boundary settings

-K Keep the original file without overwriting

-m reserved files are not overwritten

-W confirm the correctness of the compressed file

The optional parameters are as follows:

-B Set Number of blocks

-c switch to the specified directory

-f Specifies the compressed file

--HELP Display Help information

--version displaying version information

4. Common Decompression/Compression commands

Tar
Unpacking: Tar xvf Filename.tar
Package: Tar cvf filename.tar DirName
(Note: Tar is packaged, not compressed!) )

. gz
Decompression 1:gunzip filename.gz
Decompression 2:gzip-d filename.gz
Compression: gzip FileName

. tar.gz and. tgz
Decompression: Tar zxvf FileName.tar.gz
Compression: Tar zcvf FileName.tar.gz DirName

. bz2
Decompression 1:bzip2-d filename.bz2
Decompression 2:BUNZIP2 filename.bz2
Compression: Bzip2-z FileName

. tar.bz2
Decompression: Tar jxvf FileName.tar.bz2
Compression: Tar jcvf FileName.tar.bz2 DirName

. BZ
Decompression 1:bzip2-d filename.bz
Decompression 2:BUNZIP2 filename.bz
Compression: Unknown

. tar.bz
Decompression: Tar jxvf FileName.tar.bz
Compression: Unknown

. Z
Decompression: uncompress filename.z
Compression: Compress FileName

. Tar. Z
Decompression: Tar zxvf filename.tar.z
Compression: Tar zcvf filename.tar.z DirName

. zip
Decompression: Unzip Filename.zip
Compression: Zip Filename.zip DirName

. rar
Decompression: rar x Filename.rar
Compression: rar a Filename.rar DirName

Linux command: Tar

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.