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

19,402

Solution 1

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

Solution 2

You need to decompress, and then compress.

You can convert like so:

 bunzip2 -c -d file.tar.bz2 | gzip -v9 > file.tar.gz
Share:
19,402

Related videos on Youtube

Caio Tarifa
Author by

Caio Tarifa

Updated on September 18, 2022

Comments

  • Caio Tarifa
    Caio Tarifa over 1 year

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

    Do I need to compress and decompress all content?

    • jftuga
      jftuga over 7 years
      You might consider using xz instead of gzip as it can compress better at the expense of using more time and memory.
  • Admin
    Admin over 12 years
    this is nice! :-)
  • Admin
    Admin over 12 years
    this is nice too! :-)
  • Le Quoc Viet
    Le Quoc Viet over 11 years
    And GZ to BZip2: gunzip -c < file.tar.gz | bzip2 -c > file.tar.bz2
  • jftuga
    jftuga over 7 years
    Also consider gzip -9 -c ... for tighter compression.