## Zip howto

The zip program compresses files and packages them in an archive file. The unzip program extracts compressed files from the archive and uncompresses them. A zip archive file ends in .zip.

### Unzipping

Imagine you click on a link on the course web page. Your browser then downloads a file named nbody.zip into the default ~/Downloads directory. Also suppose that you also have a terminal opened with its current directory at ~/mcs178, where you keep all your stuff related to this class’s projects. If you now type

$unzip -t ~/Downloads/nbody.zip the unzip program will test the archive file nbody.zip for any error. It will also list all the files in the archive. You notice that all the compressed files are in the nbody directory. You can now unzip all the files from nbody.zip by typing $ unzip ~/Downloads/nbody.zip

and then change your current working directory into nbody by typing

$cd nbody to start working on the nbody project. ### Zipping up Now suppose you have finished working with the project and your current directory is at ~/mcs178/nbody. You are ready to submit. You first create an archive of all your work by typing $ zip myproject src/main/kotlin/*.kt readme.txt

This will create a file myproject.zip containing compressed versions of all the .kt files in the directory src/main/kotlin, and also the file readme.txt in the current directory. You can now submit your myproject.zip via moodle.

### Digging deeper

$man zip and $ man unzip