Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search
Next Previous Contents

4. Using bzip2 with tar

Listed below are three ways to use bzip2 with tar, namely

4.1 Easiest to set up:

This method requires no setup at all. To un-tar the bzip2'd tar archive, foo.tar.bz2 in the current directory, do

/path/to/bzip2 -cd foo.tar.bz2 | tar xf -

or
tar --use-compress-prog=bzip2 xf foo.tar.bz2

These work, but can be a PITA to type often.

4.2 Easy to set up, fairly easy to use, no need for root privileges:

Thanks to Leonard Jean-Marc for the tip. Thanks also to Alessandro Rubini for differentiating bash from the csh's.

In your .bashrc, you can put in a line like this:

alias btar='tar --use-compress-program /usr/local/bin/bzip2 '

In your .tcshrc, or .cshrc, the analogous line looks like this:

alias btar 'tar --use-compress-program /usr/local/bin/bzip2'

4.3 Also easy to use, but needs root access.

Update your tar to GNU's newest version, which is currently 1.13.10. It can be found at GNU's ftp site or any mirror.


Next Previous Contents