Monday, June 19, 2006

Zip Tip

Problem: You might wonder why the zip and unzip commands aren't symmetric. After all, you can run unzip file.zip to extract a file, so why doesn't zip file compress it?

laptop:~ hope$ zip file

zip warning: missing end signature--probably not a zip file (did you

zip warning: remember to use binary mode when you transferred it?)

zip error: Zip file structure invalid (file)

Solution: The reason why is because zip wants a file name for the compressed file.

laptop:~ hope$ zip filename.zip file

adding: file (deflated 71%)

Aside: What will really mess you up is that gzip-gunzip and bzip2-bunzip2 don't have the hysteresis of zip-unzip. You can run gzip file and gunzip file.gz all day long!

laptop:~ hope$ gzip file

laptop:~ hope$ gunzip file.gz

laptop:~ hope$ bzip2 file

laptop:~ hope$ bunzip2 file.bz2

Happy compressing!

No comments:

Post a Comment