Classnotes | UNIX01 | RecentChanges | Preferences No diff available--this is the first major revision.
(no other diffs)Under UNIX ZIP files are not widely used. More often than not, you will only see ZIP files used when:
A: The person supplying the ZIP files is a UNIX newbie or otherwise primarily a Windows user.
B: The person supplying the ZIP files must interoperate with Windows users and is looking for the "path of least resistance".
The ZIP algorithms are largely inferior to the alternatives under Linux. GZip can generally compress a bit better than the standard ZIP, and BZip2 is extraordinarily effective at compressing. However, if you do need to deal with ZIP files under UNIX, there are a number of commands you can use:
zip
The zip command creates new ZIP archives. The command line options are very similar to the PKZIP command line options under DOS or Windows. The general format for zip is as follows
zip [OPTIONS] [ZIPFILE] [FILE1, FILE2, ...]
For example, if I wanted to add the file "zcalc.c" to the new zip file "zcalc.zip", I would issue
$ zip zcalc zcalc.c
Note here that the .zip extension is completely optional, as zip knows to add it. The above line is equivalent to this one
$ zip zcalc.zip zcalc.c
If I wanted to ZIP a directory recursively, I would use the "-r" option. For example, if I wanted to ZIP the directory "archive/" into the ZIP file "backup_files.zip", I could issue
$ zip -r backup_files archive/
There are many more options to zip. For more information, consult zip's man page.
unzip
unzip extracts the files from a ZIP archive. The basic format for an unzip command is as follows:
I can also exclude files from extraction using the "-x" option. For example, if I wanted to extract everything from "business_archive.zip" except for "SCO_payments.txt" and "SCO_extortion.doc", I would issue
Again, unzip has many more options and features. Consult the unzip man page for more information.
zipcloak
Is a utility for creating and dealing with encrypted ZIP files. If simply called with a ZIP file, the default action is to encrypt all files in that ZIP file with a password given at the command line
$ zipcloak somefile.zip
(again, the .zip extension is optional). If you want to decrypt something, you use the "-d" option
sam@rygel:~/incoming/src$ zipcloak -d zcalc.zip
Enter password: