Quick Compression HOWTO

Hi. Here’s a quick HOWTO on using compression, and on BitTorrent. If you were looking for a real HOWTO, well, you can probably achieve compression with:

compression_program.exe uncompressed_file.txt

You could get tricky with:

cat uncompressed_file.txt | bzip2 > compressed_file.txt.bz2

Oooooh.

Certain file formats are compressed. Generally files ending in:

  • MP3, MP4
  • ZIP, RAR, ARJ, LZH
  • GZ, BZ2, TAR.GZ, TAR.BZ2
  • MPG, MPEG, MPEG2, MPEG3, MPEG4
  • OGG, FLAC
  • AVI, WMA, AAC, M4P, VOB, etc. etc. etc.

are compressed already.

This means you don’t need to compress them again. Really. You actually lose space when you do that, due to the overhead of compressing things. And time. And patience. There’s nothing I love more than getting a zipped-up set of MP3s, or a compressed tarball with a bunch of ZIP files in it, or a ZIP file with an AVI in it. Yes, I understand it’s sometimes better to grab one file than 20. If that’s the case you’re excused. This doesn’t apply to you, anyhow — you’ve used more than two brain cells to think about this already.

Second note: BitTorrent is capable of handling whole directories. If you are trying to distribute a bunch of files just make a torrent of the whole directory. Really. We don’t mind. Resist the urge to make it a single file.

Third note: Name the directory inside your compressed files, or the one inside the torrent, with a name that is helpful. After triple-decompressing your crap I love trying to figure out that the directory “clip478” was what came out of “vendors.zip” (which was inside “conference.zip”).

Thanks! 🙂

1 thought on “Quick Compression HOWTO”

  1. That’s why tar doesn’t compress. It’s for creating an archive of files and keeping them together, but not compressing them.

    I’m sure there’s a way to do this with “zip”, but why bother? 🙂

    You did forget this, though: If you’re going to archive more than one file together, put them in their own directory. I have a lot of readme and Makefiles, and I hate it when un-archiving obliterates them:

    $ mkdir foo
    $ mv readme.txt foo.c Makefile foo/
    $ tar cvf – foo/ | bzip2 >foo.tar.bz

    Is just so easy.

Comments are closed.