cancel
Showing results for 
Search instead for 
Did you mean: 

compress tar.bz2

SOLVED
Go to solution
jona_1
Frequent Advisor

compress tar.bz2

Hi,
I want to compress a tar file.
current name is test.tar. i want to make it tar.bz2.Could you please tell me the full command.
RHEL 5.2

Regards,
3 REPLIES
Matti_Kurkela
Honored Contributor
Solution

Re: compress tar.bz2

bzip2 test.tar

It will produce test.tar.bz2, and if the compression is successful, the original file will be removed.

If you want the original file to remain, then:

bzip2 test.tar.bz2

When creating a tar file, you can also compress it at the same time, by adding "j" to the tar options. For example:

tar jcf test.tar.bz2 /some/directory

MK
MK
Steven Schweda
Honored Contributor

Re: compress tar.bz2

> When creating a tar file, [...]

Or, the old-fashioned way:

tar cf - stuff | bzip2 > stuff.tar.bz2

which works with any compression filter
program (gzip, ...), and with versions of
"tar" which don't themselves know how to do
the compression.
jona_1
Frequent Advisor

Re: compress tar.bz2

Tnx all