Compress to BZIP and TAR

For example, the following commands would combine three files named file4, file5 and file6 into a single archive named file7.tar and then compress that archive into a compressed file named file7.tar.bz2:

tar -cf file7.tar file4 file5 file6

bzip2 file7.tar

Alternatively, this can all be accomplished in a single step by merely adding the -j option to tar, which tells tar to compress the archive that it creates with bzip2. Thus, the above example would be simplified to:

tar -cjf file7.tar.bz2 file4 file5 file6

Leave a Reply

Your email address will not be published. Required fields are marked *