How do I convert tar.bz2 to tar.gz?

12

5

I'm new in Linux, is this conversion possible?

Do I need to compress and decompress all content?

Caio Tarifa

Posted 2011-11-16T05:44:12.777

Reputation: 223

You might consider using xz instead of gzip as it can compress better at the expense of using more time and memory. – jftuga – 2016-10-21T22:42:13.383

Answers

19

bunzip2 -c < file.tar.bz2 | gzip -c > file.tar.gz

Jeff Ferland

Posted 2011-11-16T05:44:12.777

Reputation: 823

Also consider gzip -9 -c ... for tighter compression. – jftuga – 2016-10-21T22:42:44.623

this is nice too! :-) – None – 2011-11-16T05:50:02.247

2And GZ to BZip2: gunzip -c < file.tar.gz | bzip2 -c > file.tar.bz2 – Le Quoc Viet – 2012-10-17T02:50:16.587

6

You need to decompress, and then compress.

You can convert like so:

 bunzip2 -c -d file.tar.bz2 | gzip -v9 > file.tar.gz

Anthony Blake

Posted 2011-11-16T05:44:12.777

Reputation:

this is nice! :-) – None – 2011-11-16T05:48:50.313

0

Yes, you need to decompress and compress the content (because compression is not "compositional").

Basile Starynkevitch

Posted 2011-11-16T05:44:12.777

Reputation: 1 022