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

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

Do I need to compress and decompress all content?


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