11

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

Do I need to compress and decompress all content?

migrated from stackoverflow.com Nov 16 '11 at 7:59

This question came from our site for professional and enthusiast programmers.

  • You might consider using xz instead of gzip as it can compress better at the expense of using more time and memory. – jftuga Oct 21 '16 at 22:42
19
bunzip2 -c < file.tar.bz2 | gzip -c > file.tar.gz
  • this is nice too! :-) – Jasonw Nov 16 '11 at 5:50
  • 2
    And GZ to BZip2: gunzip -c < file.tar.gz | bzip2 -c > file.tar.bz2 – Le Quoc Viet Oct 17 '12 at 2:50
  • Also consider gzip -9 -c ... for tighter compression. – jftuga Oct 21 '16 at 22:42
6

You need to decompress, and then compress.

You can convert like so:

 bunzip2 -c -d file.tar.bz2 | gzip -v9 > file.tar.gz
  • this is nice! :-) – Jasonw Nov 16 '11 at 5:48
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.