The zip
command is used to create compressed archive files in the ZIP format. It allows users to bundle multiple files and directories into a single file, reducing storage space and making it easier to transfer data.
The basic syntax of the zip
command is as follows:
zip [options] [zipfile] [files]
-r
: Recursively zip directories.-e
: Encrypt the zip file with a password.-9
: Use the best compression method.-q
: Quiet mode; suppresses output messages.-d
: Delete specified files from the zip archive.Here are some practical examples of using the zip
command:
zip archive.zip file1.txt file2.txt file3.txt
zip -r archive.zip my_directory/
zip -e secure_archive.zip file1.txt file2.txt
zip archive.zip newfile.txt
zip -d archive.zip file1.txt
-9
option for maximum compression when file size is a priority.-q
option if you want to run the command in scripts without cluttering the output.unzip -l archive.zip
before sharing it to ensure all necessary files are included.