"BUNZIP2 command"-linux command five-minute series eight

Source: Internet
Author: User
Tags bz2

This original article belongs to the "Linux Greenhouse" blog.

The blog address is http://roclinux.cn.

Article author for Roc

I hope you can donate to support the operation and development of the Linux greenhouse blog. See "About Donations"

==

The use of the GZIP compression tool is described in "seven", but not all Linux compressed packages are. tar.gz (please believe me ^_^), you will also find that there is a type of file suffix is. tar.bz2 (which is also true). At this point, the BUNZIP2 command comes in handy.

Before we begin, it is important to explain the relationship between BUNZIP2 and bzip2. If you work under Fedora, you'll find that BUNZIP2 is a symbolic connection to bzip2. But the BUNZIP2 and bzip2 function exactly the opposite. BZIP2 is used to compress files (of course, if using special functions can also be used to extract, with the option-D can be implemented), and BUNZIP2 is used to extract the file (equivalent to bzip2-d). Analogies, as well as zip and unzip, Gzip and Gunzip, compress and uncompress.

Let's take a look at its use:

1 when you download a file for roc.tar.bz2, how do you unzip it?

# TAR-XJVF ROC.TAR.BZ2

Note: The J option indicates the use of the BUNZIP2 tool. (Yegle said can omit J, that is, do not specify a special compression tool, only with-XVF.) This is also true of ^_^)

2 I have a file abc.txt, I want to compress with BUNZIP2 compression tool!

#bzip2 Abc.txt

Note: compression will get a compressed file abc.txt.bz2, while the original abc.txt will be deleted. (This is important, as the Linux test will ask)

3 If there is a file abc.txt.bz2, want to decompress:

#bunzip2 abc.txt.bz2

Or

#bzip2-D abc.txt.bz2

Note: the extract will be abc.txt, and the original abc.txt.bz2 will be deleted.

4 If I want to compress abc1.txt,abc2.txt,abc3.txt three files, there are dir1 and DIR2 directories, a total of 5 parts, together compressed into the five.bz2:

#bzip five.bz2 abc1.txt abc2.txt abc3.txt dir1 dir2

(1) First I run the prompt bzip cannot use

(2) After changing to bzip2, also can not use, hint:

Bzip2:can ' t open input file one.bz2:No such file or directory.
Bzip2:input file Dir1 is a directory.

(3) I think it should be used in conjunction with TAR, first packaged and then compressed

5 If there are abc1.txt.bz2 and abc2.txt.bz2 two files, I would like to use a command to extract two files into Abc1.txt and abc2.txt respectively:

# BUNZIP2 abc1.txt.bz2 abc2.txt.bz2

6 If there are abc1.txt and abc2.txt two files, I would like to use a command to compress two files into abc1.txt.bz2 and abc2.txt.bz2 respectively:

# bzip2 Abc1.txt Abc2.txt

"BUNZIP2 command"-linux command five-minute series eight

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.