Linux compression and decompression

Source: Internet
Author: User
Tags decompress zip

[Tar details:]

-C: Create a compressed file-x: extract-t: View content-r: append the file to the end of the compressed archive file-u: update the five files in the original compressed package as independent commands. One of them is required for compression and decompression. It can be used with other commands, but only one of them can be used.
The following parameters are optional when files are compressed or decompressed as needed:
-Z:-j With the gzip attribute:-Z with the bz2 attribute:-v with the compress attribute: display all processes-O: unbind the file to the standard output

The following parameter-f is required

-F: use the file name. Remember, this parameter is the last parameter and can only be followed by the file name.

Tar-cf all.tar *. jpg # This command is to pack all. jpg files into a package named all.tar. -C indicates that a new package is generated.-f specifies the package file name.

Tar-rf all.tar *. gif # This command adds all .gif files to the package of all.tar. -R indicates adding files.

Tar-uf all.tar logo.gif # This command is used to update the logo.gif file in tarbao all.tar.tar.-u indicates the Update file.

Tar-tf all.tar # This command is used to list all files in the all.tar package.-t indicates listing files.

Tar-xf all.tar # This command is used to extract all files in the all.tar package.-x is used to unlock the files.


[Compressed file:]

Tar-cvf jpg.tar *. jpg # Pack all jpg files in the Directory into tar.jpg

Tar-czf jpg.tar.gz *. jpg # Images

Tar-cjf jpg.tar.bz2 *. jpg # Images

Tar-cZf jpg.tar. Z *. jpg # assets. Z

Rar a jpg.rar *. jpg # rar format compression, You need to download rar for linux

Zip jpg.zip *. jpg # zip compression, You need to download the zip for linux


[Decompress the file:]

Tar-xvf file.tar # decompress the tar package

Tar-xzvf file.tar.gz # decompress tar.gz

Tar-xjvf file.tar.bz2 # decompress tar.bz2

Tar-xZvf file.tar. Z # decompress tar. Z

Unrar e file.rar # extract rar

Unzip file.zip # decompress zip


[CONCLUSION:]

. Tar
Decompress: tar zxvf FileName.tar
Compression: tar czvf FileName.tar DirName
---------------------------------------------
. Gz
Decompress 1: gunzip FileName.gz
Decompress 2: gzip-d FileName.gz
Compression: gzip FileName

.Tar.gz and. tgz
Decompress: tar zxvf FileName.tar.gz
Compression: tar zcvf FileName.tar.gz DirName
---------------------------------------------
. Bz2
Decompress 1: bzip2-d FileName.bz2
Decompress 2: bunzip2 FileName.bz2
Compression: bzip2-z FileName

.Tar.bz2
Decompress: tar jxvf FileName.tar.bz2
Compression: tar jcvf FileName.tar.bz2 DirName
---------------------------------------------
. Bz
Extract 1: bzip2-d FileName. bz
Decompress 2: bunzip2 FileName. bz
Compression: Unknown

. Tar. bz
Decompress: tar jxvf FileName.tar. bz
Compression: Unknown
---------------------------------------------
. Z
Decompress: uncompress FileName. Z
Compression: compress FileName

. Tar. Z
Decompress: tar Zxvf FileName.tar. Z
Compression: tar Zcvf FileName.tar. Z DirName
---------------------------------------------
. Zip
Decompress: unzip FileName.zip
Compression: zip FileName.zip DirName
---------------------------------------------
. Rar
Decompress: rar a FileName.rar
Compression: r ar e FileName.rar
  
Rar Please download to: http://www.rarsoft.com/download.htm!
After decompression, copy rar_static to the/usr/bin directory (Other Directories specified by the $ PATH environment variable can also be used ):
Cp rar_static/usr/bin/rar
---------------------------------------------
. Lha
Decompress: lha-e FileName. lha
Compression: lha-a FileName. lha FileName
  
Lha please: http://www.infor.kanazawa-it.ac.jp /~ Ishii/lhaunix/download!
> After decompression, copy lha to the/usr/bin directory (Other Directories specified by the $ PATH environment variable can also be used ):
Cp lha/usr/bin/
---------------------------------------------
. Rpm
Decompress: rpm2cpio FileName. rpm | cpio-div
---------------------------------------------
. Deb
Decompress: ar p FileName. deb data.tar.gz | tar zxf-
---------------------------------------------




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.