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
up vote 16 down vote accepted
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

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

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

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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