Compression/decompression under Linux

Source: Internet
Author: User
Tags bz2 gz file rar uncompress zip extension

Decompression methods for various compressed packages under Linux

INTQ Time: 2009-9-25 article source: from the network

--------------------------------------------------------------------------------

. 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

Unzip: Tar jxvf FileName.tar.bz2 or tar--bzip xvf 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

Compress a directory using the-r parameter,-R recursion. Example: $ zip-r filename.zip DirName

———————————————

. rar

Decompression: rar x Filename.rar

Compression: rar a Filename.rar DirName

RAR please to: http://www.rarsoft.com/download.htm download!

After extracting, copy the rar_static to the/usr/bin directory (other directories specified by the $PATH environment variable are also available):

[email protected] tmp]# CP Rar_static/usr/bin/rar

———————————————

. Lha

Decompression: Lha-e Filename.lha

Compression: Lha-a Filename.lha FileName

LHA please go to: http://www.infor.kanazawa-it.ac.jp/~ishii/lhaunix/download!

> After unpacking, copy the LHA to the/usr/bin directory (other directories specified by the $PATH environment variable are also available):

[email protected] tmp]# CP lha/usr/bin/

———————————————

. rpm

Unpacking: Rpm2cpio filename.rpm | Cpio-div

———————————————

. deb

Unpacking: ar p filename.deb data.tar.gz | Tar zxf-

———————————————

. Tar. tgz. tar.gz. Tar. Z. tar.bz tar.bz2. zip. cpio. rpm. Deb. SLP. Arj

. rar. Ace. Lha. Lzh. Lzx. Lzs. Arc. SDA. lnx. Zoo. cab. kar. cpt. Pit, sit. Sea

Decompression: sEx x filename.*

Compression: SEx a filename.* FileName

Sex just call the relevant program, itself and no compression, decompression function, please note!

Sex please to: http://sourceforge.net/projects/sex download!

After unpacking, copy the sex to the/usr/bin directory (other directories specified by the $PATH environment variable are also available):

[email protected] tmp]# CP sex/usr/bin/

*****************************************************************

Common file decompression methods and commands under Linux

System System

1. A file with an extension of. A:

#tar XV File.a

2. Files with a. z Extension:

#uncompress file. Z

3. Files with the extension of. GZ:

#gunzip file.gz

4. Files with the extension of. BZ2:

#bunzip2 file.bz2

5. Files with the extension of. Tar.z:

#tar Xvzf File.tar.z

or #compress-dc File.tar.z | Tar xvf

6. Files with the extension of. Tar.gz/.tgz:

#tar Xvzf file.tar.gz

or GZIP-DC file.tar.gz | Tar xvf-

7. Files with the extension of. TAR.BZ2:

#tar xvif file.tar.bz2

or BZIP2-DC file.tar.bz2 | XVF-

8. Files with the extension of. Cpio.gz/.cgz:

#gzip-DC File.cgz | Cpio-div

9. Files with the extension of. Cpio/cpio:

#cpio-div File.cpio

or CPIO-DIVC File.cpio

10. Install files with an extension of. RPM:

#rpm-I. file.rpm

11. Unzip the file with an extension of. RPM:

#rpm2cpio file.rpm | Cpio-div

12. Install files with the. deb Extension:

#dpkg-I. File.deb

13. Unzip the file with a. deb extension:

#dpkg-deb-fsys-tarfile File.deb | Tar Xvf-ar P

File.deb data.tar.gz | Tar Xvzf-

14. Files with a. zip extension:

#unzip File.zip

Unzip files in WinZip format under Linux

If you have a JDK, you can use the Jar command, and you can do so with the unzip command.

Unzip the. tar.gz file directly

The xxxx.tar.gz file uses the tar band ZXVF parameter, which can be unpacked at once. XXXX is the file name. For example:

$tar ZXVF xxxx.tar.gz Decompression of various compressed files (installation method)

File name extension Decompression (installation method)

. A AR XV file.a

. Z uncompress file. Z

. GZ Gunzip file.gz

. bz2 BUNZIP2 file.bz2

. Tar. Z Tar xvzf file.tar.z

COMPRESS-DC File.tar.z | Tar xvf-

. tar.gz/.tgz Tar xvzf file.tar.gz

GZIP-DC file.tar.gz | Tar xvf-

. tar.bz2 Tar xvif file.tar.bz2

BZIP2-DC file.tar.bz2 | XVF-

. Cpio.gz/.cgz GZIP-DC File.cgz | Cpio-div

. Cpio/cpio Cpio-div File.cpio

CPIO-DIVC File.cpio

. Rpm/install Rpm-i file.rpm

. rpm/extract Rpm2cpio file.rpm | Cpio-div

. Deb/install Dpkg-i File.deb

. deb/exrtact Dpkg-deb-fsys-tarfile File.deb | Tar xvf-

AR P file.deb data.tar.gz | Tar Xvzf-

. zip Unzip File.zip

Bzip2-d myfile.tar.bz2 | Tar xvf

Tar Xvfz myfile.tar.bz2

X is decompression

V is a complex output

F is the specified file

Z GZ format

Gzip

gzip[option] File name to compress (or decompress)

-C writes the output to the standard output and retains the original file.

-D compresses the compressed file.

-L Displays the following fields for each compressed file: The size of the compressed file, the size of the uncompressed file, the compression ratio, the name of the uncompressed file

-R recursively finds the specified directory and compresses or compresses all of its files.

The-t test compressed file is just intact.

-V for each compressed and uncompressed file, display its file name and compression ratio.

-num-adjusts the speed of compression with the specified number.

Example:

Make a backup of all files in the/usr directory, including its subdirectories, with the backup file named Usr.tar

Tar cvf usr.tar/home

Make a backup and compress all the files in the/USR directory and include its subdirectories, and the backup file name is usr.tar.gz

Tar czvf usr.tar.gz/usr

Compress a set of files with a suffix of tar.gz

#tar CVF back.tar/back/

#gzip-Q Back.tar

Or

#tar CVFZ back.tar.gz/back/

Releases a file with a suffix of tar.gz.

#tar ZXVF back.tar.gz

#gzip back.tar.gz

#tar XVF Back.tar

Compression/decompression under Linux

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.