Various compression decompression methods under Linux/centos/redhat

Source: Internet
Author: User
Tags rar

1.Zip command

Zip-r myfile.zip./*

All files and folders under the current directory are compressed into myfile.zip files, and-R indicates that all files in the subdirectory are compressed recursively.

2.Unzip

Unzip-o-d/root/myfile.zip

Unzip the Myfile.zip file to/root/

-O: Overwrite the file without prompting;

-d:-d/root indicates that the file is extracted to the/root directory;

3. other

zip-d Myfile.zip Test.txt

To delete a test.txt file in a compressed file

Zip-m Myfile.zip./add.txt

To add a add.txt file to a myfile.zip in a compressed file

4. A detailed description of thetar command

-C: Create compressed archives

-X: Unzip

-T: View content

-r: Append files to the end of a compressed archive file

-U: Update files in original compressed package

These five are stand-alone commands, which use one of the compression decompression, and can be used with other commands but only one. The following parameters are compressed or decompressed as needed in the archive

Optional.

-C: Create compressed archives

-X: Unzip

-T: View content

-r: Append files to the end of a compressed archive file

-U: Update files in original compressed package

The following parameter-F is required

-F: Use the file name, remember that this parameter is the last parameter, can only be followed by the file name.

# TAR-CF All.tar *.jpg

This command is to make all. jpg files into a package named All.tar. -C is the file name that represents the generation of a new package,-f specifies the package.

# TAR-RF All.tar *.gif

This command adds all the. gif files to the All.tar package. -R is meant to increase the file.

# Tar-uf All.tar logo.gif

This command is to update the original tar package All.tar in the logo.gif file,-U is to indicate the meaning of the update file.

# TAR-TF All.tar

This command is to list all the files in the All.tar package,-T is to list the meaning of the file

# TAR-XF All.tar

This command is to solve all the files in the All.tar package,-T is to untie the meaning

Compression

TAR–CVF Jpg.tar *.jpg//package all JPG files in the directory into tar.jpg

TAR–CZF jpg.tar.gz *.jpg//package all JPG files in the directory into Jpg.tar and compress them in gzip to generate a gzip compressed package named

Jpg.tar.gz

TAR–CJF jpg.tar.bz2 *.jpg//pack all JPG files in the directory into Jpg.tar and compress them in bzip2 to generate a bzip2 compressed package named

jpg.tar.bz2

TAR–CZF jpg.tar.z *.jpg//pack all JPG files in the directory into Jpg.tar, and compress them in compress to generate a umcompress compressed package,

Named Jpg.tar.z

RAR a jpg.rar *.jpg//rar format compression, you need to download RAR for Linux first

Zip jpg.zip *.jpg//zip format compression, need to download zip for Linux First

Extract

TAR–XVF File.tar//Unpacking the TAR Package

TAR-XZVF file.tar.gz//Decompression tar.gz

TAR-XJVF file.tar.bz2//Decompression tar.bz2

TAR–XZVF file.tar.z//Unzip tar. Z

Unrar e file.rar//decompression rar

Unzip File.zip//Unzip zip

5. summarize This article by Www.169it.com Collection and collation

1, *.tar with TAR–XVF decompression

2, *.gz with gzip-d or gunzip decompression

3, *.tar.gz and *.tgz with TAR–XZF decompression

4, *.bz2 with bzip2-d or with BUNZIP2 decompression

5, *.tar.bz2 with TAR–XJF decompression

6, *. Z Extract with Uncompress

7, *.tar. Z Extract with Tar–xzf

8, *.rar with Unrar e decompression

9, *.zip with unzip decompression

Article Source: various compression decompression methods under Linux/centos/redhat

Various compression decompression methods under Linux/centos/redhat

Related Article

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.