Liux tips-decompress various files

Source: Internet
Author: User
Tags gz file unpack

. Tar
Unpack: Tar xvf filename.tar
Package: Tar CVF filename.tar dirname
(Note: tar is packed, not compressed!)
---------------
. 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

Gzip-1 file quick Compression

Gzip-9 file best compression

Gunzip File

Gunzip-D File

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

To process the. rar file in linux, you must install RAR for Linux.


. Rar
Decompress: RAR x filename.rar
Compression: rar a filename.rar dirname

---------------
. LHA
Decompress: LHA-e filename. LHA
Compression: LHA-a filename. LHA filename
---------------
. Rpm
Unpack: rpm2cpio filename. RPM | cpio-Div
---------------
. Deb
Unpack: Ar P filename. Deb data.tar.gz | tar zxf-
---------------
. Sea
Decompress: Sex x filename .*
Compression: Sex a filename. * filename

Sex is only related to callProgram, It does not have the compression and decompression functions. Please note!

Gzip command
There are two obvious advantages to reduce the file size. One is to reduce the storage space, and the other is to reduce the transmission time when the file is transmitted over the network. Gzip is a frequently used command in Linux to compress and decompress files, which is convenient and easy to use.

Syntax: gzip [Option] compressed (decompressed) file name the meaning of each option of this command is as follows:

-C writes the output to the standard output and keeps the original file. -D. decompress the compressed file. -L the following fields are displayed for each compressed file: size of the compressed file, size of the uncompressed file, and compression ratio; name of the uncompressed file-r recursively searches for the specified directory and compresses all the files or decompress them. -T test to check whether the compressed file is complete. -V displays the file name and compression ratio for each compressed and decompressed file. -Num uses the specified numeric num to adjust the compression speed.-1 or -- fast indicates the fastest compression method (low compression ratio), and-9 or -- best indicates the slowest compression method (high compression ratio ). The default value is 6. Command instance:

Gzip * % compresses each file in the current directory into A. GZ file. Gzip-DV * % decompress each compressed file in the current directory and list detailed information. Gzip-L * % detailed information of each compressed file in Example 1 is displayed without decompression. Gzip usr.tar %: the compressed tar backup file usr.tar. the extension name of the compressed file is .tar.gz.

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.