An EPUB file is really just a zip file that compresses the HTML, CSS, and other content files into one package. The structure of an EPUB package usually looks something like this:
While it is possible to zip and unzip an EPUB file in the command line or terminal, it is much easier to do this with one of the tools mentioned below.
The best tool for zipping and unzipping EPUB files is eCanCrusher. This tool works in both Mac and PC, and does not do anything to your files except the zipping/unzipping.
For Mac, there is an AppleScript that allows you to easily drag/drop a folder to create an EPUB file, or drag/drop an EPUB to unzip it for editing. You can download that script at Google Code.
For Windows, ePubPack is an easy-to-use tool that will allow you to zip up files into an EPUB package.