April 10, 2008

Extract .bz2 on Linux

Filed under: cool, education, linux, one-liner, tip, tool — michaelangela @ 8:37 pm

I am updating some python libs on my webfaction host. The python easy_setup isn’t working for this particular bit though which is unusual. It’s the first time it didn’t work. The reason? It seems it chokes on .bz2 archives. The one in particular is python-dateutil. Fortunately a quick wget later and it’s downloaded. On OS X, .bz2 archives are handled natively. I didn’t know how to do that on Linux though but this post had the answer. In this case I needed the tar xjvf variant. A later poster noted that years later it was still a useful post. This is now even later and still useful. 🙂

how do i extract .bz2 – Linux Forums

If it’s .tar.bz2, then you can use

tar xjvf cornbread.tar.bz2

to extract it all at once. If it’s just .bz2, then use

bunzip2 spankythefish.bz2

Hope this helps.

Update: I was installing Amara which I have been using for some XML handling. Installing it for python 2.5 on my host prompted the install of python-dateutil as a dependency. That didn’t happen on the Mac as I did it just now. Interesting. Also installing python-dateutil on the Mac went without a hitch. It recognized the archive type and just brought it in no problem. It probably has to do with bz2 support on the system then? But the tar xjvf can handle it on the host so something somewhere isn’t checking the file type. Interesting.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: