The bzip2 and bunzip2 tackle two different tasks. The bzip2 tool handles compression and the bunzip2 tool handles decompression. Because of this, the basic usage is very simple:
To compress a file the command would look like: bzip2 filename
Where filename is the actual file name to be compressed. The resulting compressed file will look like filename.bz2.
To decompress a file the command would look like: bunzip2 filename.bz2
Where filename.bz2 is the actual file name to decompress. The resulting decompressed file will be filename.
The bzip2 tools are not archiving tools. In order to compress a directory, the directory must be archived first. If you have a large directory, say TEMP, and you want more compression than gzip gives you, you will have to use the tar archiving tool to first archive the directory. Once the directory is archived it can be compressed with gzip2. So both commands for this would look like:
tar cf TEMP.tar TEMP
The resulting file would be TEMP.tar.bz2