bzip2 is another popular compression method used on Linux. On average, bzip2 is slower than gzip; however, bzip2 does a better job of compressing files to smaller sizes.
You can compress an archive with bzip2 compression by using the -j option with the tar command as follows:
tar -cjf compressed_archive archive_name
Notice the only difference here is that we use the -j option for bzip2 compression instead of -z for gzip compression.
So to compress the scripts.tar archive into a bzip2-compressed archive named scripts.tar.bz2, you first need to change to the /root/backup directory and then run the following command:
root@ubuntu-linux:~/backup# tar -cjf scripts.tar.bz2 scripts.tar
Now if you list the contents of the backup directory, you will see the newly created bzip2-compressed archive scripts.tar.bz2:
root@ubuntu-linux:~/backup# ls
scripts.tar scripts.tar.bz2 scripts.tar.gz
Let's run the file command on the bzip2-compressed archive scripts.tar.bz2:
root@ubuntu...