Ubuntu file compression and decompression

Source: Internet
Author: User

Ubuntu system under the compression file suffix has several tar,tar.gz,tar.bz2,zip, and so on, the file compression and decompression does not want Windows as convenient, directly right-click Compression or decompression. Ubuntu below for different compression suffix names need to be pressurized or decompressed with different commands.


1.. zip

Compression: Zip-r file.zip dir

Decompression: Unzip File.zip


2.. tar

Package: TAR-CVF File.tar dir

Decompression: TAR-XVF File.tar

TAR-XVF file.tar/usr/


3.. tar.gz and. tgz

Compression: TAR-ZCVF file.tar.gz dir

Decompression: TAR-ZXVF file.tar.gz

TAR-ZXVF file.tar.gz/usr/


4.. tar.bz2

Compression: TAR-JCVF file.tar.bz2 dir

Decompression: TAR-JXCVF file.tar.bz2

TAR-JXCVF file.tar.bz2/usr/


5.. BZ and. bz2

Compression: Bzip2-z dir

Decompression: bzip2-d file.bz2

BUNZIP2 file.bz2


6.. z

Compression: Compress dir

Decompression: uncompress file.z


7.. tar. Z

Compression: Tar zcvf file.tar.z dir

Decompression: Tar zxvf file.tar.z


8.. rar

Compression: rar a file.rar dir

Decompression: rar x File.rar


Tar command parameter options:
-C Create a new archive file
-R append file to end of archive file
-X to extract files from an archive file
This can be remembered, the creation of a new file is C, appended to the original file with R, extracted from the file with X

-O unpack the file to standard output
-V Process Output related information
-F to normal file operation---seems to always use F, otherwise, may not show
-Z Call gzip to compress the archive, and invoke gzip to complete the decompression when associated with-X
-Z Call compress to compress the archive, call compress to complete the decompression with the-X union

-T: View the files inside the Tarfile!
In particular, in the release of the parameters, c/x/t can only exist one! Cannot exist at the same time!

-P: Use original file properties (attributes are not changed according to user)
-P: You can use absolute path to compress!
-N: Newer than next date (YYYY/MM/DD) will be packaged in the new file!
--exclude file: In the process of compression, do not package file!




Ubuntu file compression and 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.