How to Zip Multiple Files in Unix

By Dave Wilson

The "ZIP" utility provides the ability to compress files and also group a number of files together into a single ".zip" file for easy storage and transport. Including a number of files in a .zip file simplifies the process of attaching multiple files to an email or archiving related files in a compressed format for later use. The procedure for creating a .zip file that contains multiple files can be completed in a few steps.

Things You'll Need

  • Bash shell and zip programs

Step 1

Log in to the Unix, BSD or Linux computer command line using account credentials that have permissions to run the "Zip" program.

Step 2

Navigate to the folder location of the files you wish to contain in a single .zip file by typing "cd /home/youraccount/filesdirectory" and pressing the "Enter" key. Substitute "/home/youraccount/filesdirectory" with the full path of the files to be included in the .zip file.

Step 3

Type "zip file.zip file1 file2 file3 " and press the "Enter" key, substituting "file.zip" with the name you wish to call the .zip file and substituting "file1 file2 file3" with the actual names of the files to be included in the .zip file. The .zip file should appear in the current directory once the process is completed. If the Zip program displays error output on the screen or does not run, proceed to the next step.

Step 4

Type "find / -name zip" and press the "Enter" key. Note the path for the Zip program displayed in the output of the "find" command.

Step 5

Type "/usr/bin/zip file.zip file1 file2 file3" and press the "Enter" key, substituting the "/usr/bin/" with the full path to the Zip program as provided by the "find" command; substituting "file.zip" with the name you wish to assign to the .zip file and substituting "file1 file2 file3" with the actual names of the files to be included in the .zip file. The .zip file should now appear in the current directory.