Zip Howto

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

Example uses

  1. Suppose you clicked on a link on the course web page and your browser have downloaded a file named, say, nbody.zip into your default ~/Downloads directory. Also suppose you already have your terminal opened and your current directory is at ~/mcs178/nbody-project where you’re keeping your Kotlin programs. 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 zip archive. You will notice that all the compressed files are in the nbody folder.

    You can now unzip all the files from nbody.zip by typing

    $ unzip ~/Downloads/nbody.zip
  2. Now suppose you have finished working with your files in the folder ~/mcs178/nbody-project and are ready to submit them. You can type

    $ zip myproject file1.kt file2.kt readme.txt

    This will create a file myproject.zip containing compressed versions of file1.kt, file2.kt, and readme.txt. You can now submit your myproject.zip via moodle.

Digging deeper

To learn more about zip and unzip, read the manual by typing:

$ man zip

and

$ man unzip