Decompress tar GZ bz2 tgz zip and other Linux Files.

Source: Internet
Author: User
Tags uncompress

Http://hi.baidu.com/ggwork/blog/item/d52c48245e823923d40742b9.html

 

 

For those who are new to Linux, they will surely get dizzy with a bunch of various file names in Linux. Other
For example, we know that there are only two common types of compressed files in windows.
. Zip, and the other is. rar. It can be the same as linux.tar.gz, tgz, bz2,
.Z).tarmultiple compressed file names, which can also be used in windows,
There are too few people using .zipand .rar in. This article describes the common compressed files.
I hope you will not be confused when you get these files. icon_smile.gif

Before summarizing various types of compressed files, we should first clarify two concepts: Packaging and compression. Packaging refers
Convert a large number of files or directories into a total file.
The algorithm is converted into a small file. Why do we need to differentiate these two concepts? In fact, this is due to a lot of pressure in Linux
The program can only compress one file, so that when you want to compress a large number of files, you must first use
In addition, its tool first makes a package of these large files, and then compresses the original compression program.

In Linux, the most common package is tar. The package produced by using tar is often called Tar package.
The command of the TAR package usually ends with .tar. After the tar package is generated, you can use other programs
Line compression, so first let's talk about the basic usage of the tar command:

There are many options for the tar command (which can be viewed using man TAR), but there are several commonly used options. below
For example:

# 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.
Meaning.
# Tar-UF all.tar logo.gif
This command is used to update the logo.gif file in tarbao all.tar.-u indicates that the file is updated.

# Tar-TF all.tar
This command is used to list all files in the all.tar package.-T is used to list objects.

# Tar-XF all.tar
This command is used to extract all files in the all.tar package.-X is used to unlock the file.

The above is the most basic usage of tar. To help you compress or decompress the package
File, tar provides a special feature. This means that tar can call other pressures while packaging or unpacking.
Program shrinking, such as calling gzip and Bzip2.

1) tar calls Gzip

Gzipis a program developed by gnuorganization. The file ending with .gz is the result of gzip compression. And Gzip
The relative decompression program is gunzip. Use the-Z parameter in tar to call gzip. The following is an example.
:

# Tar-CZF all.tar.gz *. jpg
This command is to compress all .jpg files into a tar package and use gzip to generate
The package name is all.tar.gz.

# Tar-xzf all.tar.gz
This command unlocks the generated package.

2) tar call Bzip2

Bzip2is a more powerful compression program. The file ending with .bz2 is the result of Bzip2 compression.
The decompress program relative to Bzip2 is bunzip2. Use the-J parameter in tar to call gzip. The following is an example.
Note:

# Tar-CJF all.tar.bz2 *. jpg
This command is to compress all .jpg files into a tar package and use Bzip2 to generate
Bzip2compressed package named all.tar.bz2

# Tar-xjf all.tar.bz2
This command unlocks the generated package.
3) tar call Compress

Compress is also a compression program, but it seems that people who use compress are not as good as those who use gzip and Bzip2.
More .. The file ending with Z is the result of Bzip2 compression. The decompress program relative to compress is uncompress.
. Use the-Z parameter in tar to call compress. The following is an example:

# Tar-CZF all.tar. z *. jpg
This command is to compress all .jpg files into a tar package and generate
An uncompress compressed package named all.tar. Z

# Tar-xzf all.tar. Z
This command is used to unbind the generated package.

With the above knowledge, you should be able to uncompress a variety of files, the following for the tar series of compressed files
As a summary:

1st pair of files ending with .tar

Tar-XF all.tar

2XX for the file ending with .gz

Gzip-D all.gz
Gunzip all.gz

32.16.tgzor .tar.gz

Tar-xzf all.tar.gz
Tar-xzf all. tgz

4)for the file ending with .bz2

Bzip2-D all.bz2
Bunzip2 all.bz2

5 bytes for the file ending with tar.bz2

Tar-xjf all.tar.bz2

6) for files ending with. Z

Uncompress all. Z

72.16.tar. Z

Tar-xzf all.tar. Z

In addition, Linux also has corresponding methods to decompress the compressed file .zipand .rar under windows.
Guys:

1)for. Zip

Linux provides zip and unzip programs, Zip is a compression program, and unzip is a decompression program. Their Parameters
There are many options. Here we will only give a brief introduction. We will still give an example to illustrate its usage:

# Zip all.zip *. jpg
This command compresses all .jpg files into a zip package.
# Unzip all.zip
This command decompress all files in all.zip.

2XX vs. .rar

To process the. rar file in linux, you must install RAR for Linux. You can download the file from the Internet.
Living, rar for Linux
Not free; available from http://www.rarsoft.com/download.htm


Download rarfor Linux 3.2.
0, and then install:

# Tar-xzpvf rarlinux-3.2.0.tar.gz
# Cd RAR
# Make

After the installation, there will be two programs, RAR and unrar. rar is the compression program, unrar
Is the decompression program. They have many Parameter options. Here we will only give a brief introduction and give examples to illustrate their usage:

# Rar a all *. jpg
This command is to compress all. jpg files into a rarpackage named all.rar. this program will
The extension name is automatically appended to the package name.

# Unrar e all.rar
This command is to extract all files from all.rar.

So far, we have introduced tar, Gzip, gunzip, Bzip2, bunzip2, compress in Linux.
, Uncompress, zip、unzip、rar、unrar, you should have been able to use their corresponding .tar
10 types of compressed files: .gz).tar.gz2.16.tgz2.16.bz22.16.tar.bz2 and. z).tar.z2.16.zip).rar
After the tool is decompressed, you do not need to download a software and do not know how to unlock it in Linux.
Annoyed. In addition, the above method is basically effective for Unix.

This article introduces the Linux compressed program tar, Gzip, gunzip, Bzip2, bunzip2, compress
, Uncompress, zip, unzippered rar、unrarand so on.
10 types of compressed files, including .tar.gz).tgz2.16.bz22.16.tar.bz2,. Z, and. tar.z#.zip#.rar.
Operation.7zip

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.