BREAKING NEWS

2012/05/29

Compress and Extract bz2 Archives using MAC OS X


The Bzip archive format is generally more effective at compressing than zip and gzip, and while the default Archive Utility or the excellent all-purpose Unarchiver tool will handle unarchiving bzip2 files with ease, you will have to venture to the command line if you want to create a bzip archive in Mac OS X.

Creating a BZ2 Archive:


bzip2 -z filetocompress

The output of this command is the compressed file, it does not create a compressed copy of the file. To clarify with the example above, you’d see a file named “filetocompress.bz2″ within the working directory and the original “filetocompress” would be missing.

Remember that bzip2 does not bundle files, it just compresses them. If you want to add a group of files to a bzip archive you’d want to use tar beforehand. Some versions of tar even support creating bz2 archives natively with the -j flag, but that doesn’t appear to be implemented in Mac OS X.

Of course you can also decompress bz2 archives from the command line with either the bzip2 or bunzip2 commands:

bzip2 -d file.bz2

Or bunzip2:

bunzip2 archivefile.bz2

Or just double-click the bz2 file in the Finder.

Share this:

Post a Comment

 
Copyright © 2014 Deepersolids. Designed by OddThemes