If you use a Linux Ubuntu Server, and you need to create a zip archive file of a folder, you can use the command zip -r [zipfile.zip] [directory] on the command line.

In the tutorial guide, let’s see how you can create a zip of a single or multiple folders and protect it with a password. Here are some options for these:
Option 1: Zip Folder Ubuntu Linux
To create a zip on the command line of a folder, you need to use the zip -r zip_name.zip directory_name command:
zip -r zip_name.zip folder
For example, if you have a folder named myPhotosFolder and you want to create a my_photos_folder.zip file of it, you would use the following command on terminal:

zip -r my_photos_folder.zip myPhotosFolder
Option 2: Create Zip Multiple Folders at Once Linux Ubuntu
To create a zip of multiple folders at once command line, you can use zip -r my_zip_file.zip folder1 folder2 folder3 command on an Ubuntu Linux command line:
zip -r my_zip_file.zip folder1 folder2 folder3
For example, if you have a multiple folder named myPhotosFolder, myPhotosFolder1, myPhotosFolder2 and you want to create a my_all_photos_folder.zip file of it, you would use the following command:
zip -r my_all_photos_folder.zip myPhotosFolder myPhotosFolder1 myPhotosFolder2
Option 3: Password Protected Folder Linux Ubuntu
To create password protected zip file of the folder on the command line, you can use the -e option with zip -r zip_name.zip directory_name command, you can see this:
zip -e archivename.zip folder
The command will be prompted to enter and verify the archive password:
Enter password: Verify password:
For example, if you have a folder named myPhotosFolder and you want to create a my_photos_folder.zip file of it password protected, you would use the following command:
zip -r -e my_photos_folder.zip myPhotosFolder
my_photos_folde.zip file of MyPhotoFolder that you have created is password protected.
Here is the video guide on how to zip folder on linux ubuntu terminal:
Conclusion
That’s it; You have learned how to create a zip file of a folder with password protected and without a password in the Linux Ubuntu command line.

If you have any questions related to this tutorial, you can ask in comment box.
Recommended Tutorials
Discover more from Jassweb
Subscribe to get the latest posts sent to your email.
