Zip Command
The zip command is a powerful utility for creating and
managing compressed archives. It's widely used in Unix-like
operating systems for bundling multiple files into a single archive,
reducing storage space and simplifying file transfer. This tool is
essential for developers and system administrators for efficient
data management.
Create Zip Archives
To create a basic zip file containing specified files and directories, you can use the following syntax:
# To create zip file:
zip archive.zip file1 directory/
For creating a recursive zip archive of an entire directory, including all its contents:
# To create zip file from directory:
zip -r archive.zip directory/
Secure Zip Archives with Passwords
Protect your sensitive data by creating password-protected zip archives. This ensures that only individuals with the correct password can extract the contents.
# To create zip file with password:
zip -P password archive.zip file1
Manage Split and Joined Zip Files
The zip command also supports splitting large archives
into multiple smaller parts, which can be useful for storage or
transfer limitations. To rejoin these split files:
# To join a split zip file (.zip, .z01, .z02, etc):
zip -FF splitZipfile.zip --out joined.zip
Related Tools: Unzip
For listing, testing, and extracting the contents of zip archives,
the unzip command is the complementary utility. It
provides comprehensive options for managing zip files.
# To list, test and extract zip archives, see unzip:
cheat unzip