Prerequisite: Verify if zip is installed
sudo apt install zip unzip
Now that you know your system has zip support, you can read on to learn how to zip a directory in Linux.
Zip a folder in Linux Command Line
The syntax for using the zip command is pretty straight forward.
zip [option] output_file_name input1 input2
While there could be several options, I don’t want you to confuse with them. If your only aim is to create a zip folder from a bunch of files and directories, use the command like this:
zip -r output_file.zip file1 folder1
The -r option will recurse into directories and compress its contents as well. The .zip extension in the output files is optional as .zip is added by default.