Basic usage is simple, the man page doesn’t always get to the examples quickly so I thought I’d write about it for a quick reference.
Make sure it’s installed – this will install it on Debian or Ubuntu
apt-get install zip unzip
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: unzip zip 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 419 kB of archives. After this operation, 998 kB of additional disk space will be used. Get:1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main unzip amd64 6.0-9ubuntu1.5 [157 kB] Get:2 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main zip amd64 3.0-8 [262 kB] Fetched 419 kB in 0s (8,201 kB/s) Selecting previously unselected package unzip. (Reading database ... 155462 files and directories currently installed.) Preparing to unpack .../unzip_6.0-9ubuntu1.5_amd64.deb ... Unpacking unzip (6.0-9ubuntu1.5) ... Selecting previously unselected package zip. Preparing to unpack .../archives/zip_3.0-8_amd64.deb ... Unpacking zip (3.0-8) ... Processing triggers for man-db (18.104.22.168-1ubuntu1) ... Processing triggers for mime-support (3.54ubuntu1.1) ... Setting up unzip (6.0-9ubuntu1.5) ... Setting up zip (3.0-8) ...
zip -r my_archive.zip file_1.doc file.txt file_2013_02_01.png
or to zip a directory
zip -r my_archive.zip folder1
Same as above but also add a password
zip -r --password BIGSECRET my_archive.zip folder1