Breaking News

By , Unix Dweeb, Network World |
Both the Linux zip and zipcloak commands can create encrypted zip files, but they have some important and interesting differences. Here’s what you need to know about how they work and what you should understand when using them.
The zip command provides an easy way to take a group of files and squeeze their content into a single smaller file. To join a group of files into a single file—often done to make copying them to other systems considerably easier—use a command like the one shown below. The first argument is the name to be used for the zip file and is followed by the list of files to be included.
The command below provides a simple example in which files are joined in an encrypted zip file. Notice that the -e option that specifies that the resultant zip file is to be encrypted. The command will fail if you don’t enter the same password at each prompt.
The zip command not only stores the files together, but reduces the size of the files in the process. The zip file in these examples is less than half the size of the two files combined. Notice the “deflated” lines in the output shown above.
The original files, after being added to the encrypted zip file, can be deleted afterwards, but you will need to preserve the password used so that you can extract the contents later.
You can also use the zip command to recursively collect files and include them in a single zip file. Here’s an example command that would put all of the files in your bin directory into a file named “”.
While the zip command can create encrypted files, it cannot encrypt existing zip files. For that, you can use the zipcloak command or go through the process of extracting the zip file’s contents and then re-zipping them using the -e option to put them back together in encrypted form.
NOTE: Zip files are smaller than the collection of separate files included in them whether or not they are encrypted.
The zipcloak command is different from zip in one very important way: It will encrypt or decrypt an existing zip file, but it will not create a zip file on its own. To use the zipcloak command to encrypt a zip file, use a command like the one shown below.
After the encryption, resultant file is nearly identical in size to the one created without encryption. In this case, it’s just a bit smaller.
The unzip command will extract the contents of zip files whether they are encrypted or not. It will, however, ask for the password for encrypted files.
If files by the same names exist in the directory, you will be asked whether you want to overwrite them. In addition, you can select individual files from a zip file if you don’t want to extract all of them. Here is an example of both extracting a single file and electing to overwrite the current file:
The zip and zipcloak commands are properly compatible. The unzip command can extract content from unencrypted and encrypted zip files and works as expected whether the files were encrypted with a zip -e (encrypt) command or a zipcloak command. Similarly, the zipcloak -d (decrypt) command will decrypt an encrypted zip file whether it was encrypted with a zip -e command or a zipcloak command.
Zip files are generally used to locally back up groups of files that might be undergoing changes or to copy files to other systems one group at a time. The zip and unzip commands allow you to easily create or extract content from zip files. The zipcloak command allows you to encrypt zip files or extract from encrypted zip files.
Next read this:

  • 9 career-boosting Wi-Fi certifications
  • What is MPLS, and why isn’t it dead yet?
  • 11 ways to list and sort files on Linux
  • 5 free network-vulnerability scanners
  • How-to measure enterprise Wi-Fi speeds

Sandra Henry-Stocker has been administering Unix systems for more than 30 years. She describes herself as “USL” (Unix as a second language) but remembers enough English to write books and buy groceries. She lives in the mountains in Virginia where, when not working with or writing about Unix, she’s chasing the bears away from her bird feeders.
Copyright © 2022 IDG Communications, Inc.
Copyright © 2022 IDG Communications, Inc.


Leave a Reply

Your email address will not be published. Required fields are marked *

Share Article: