zip is the command to package and compress files together as .zip extension. Simply type zip + name of the zip file + name of the files to be compressed as .zip.
zip -r [target.zip] [source1] [source2]
Say you want to compress a file named test.txt and an image named image.png together in one zip file named test.zip. This is what it should look like:
zip -r test.zip text.txt image.png
In this case it should return a test.zip file in your desktop with a directory inside containing the two files together.

Flags

  • -e: create zip files that require a password in order to be uncompressed.
    zip -e test.zip text.txt image.png
        Enter password: (password required to unzip the file)
    
  • -u: update zip files and add new files inside the current zip file.
    zip -u test.zip newtext.txt
    
    The newtext.txt file will be added to the current test.zip file.
  • -d: remove files inside the current zip file.
    zip -d test.zip newtext.txt
    
    The newtext.txt file will be removed from the current test.zip file.