Before we start, here are some options used with the tar Terminal command: -f – in combination with the -c option is used to create a tar file from the specified file, in conjunction with the option -x is used to unzip the specified file; -j – compress the tar file with the bzip2 program. Sudo apt-get install zip. I see from man zip that it allows me to use a file list: [email protected] file lists. If a file list is specified as [email protected] Not on MacOS, zip takes the list of input files from standard input instead of from the command line. For example, zip [email protected] foo. So I created zip.lst which looks like this.

In this tutorial we will learn to create password protected and encrypted zip file using the Terminal.

Let's say you have a folder containing some confidential files and you want to create a zip file that is password protected and encrypted.

Creating a plain zip file is not wise as it provides no extra security. Moreover, anyone can unzip that file and access your confidential content.

To protect the zip file from prying eyes and unauthorized access you can encrypt the zip file using a strong password. This way only authorized persons who have the password can unzip the encrypted zip file.

Alright, let's go ahead and create an encrypted zip file.

Step 1: Open Terminal

Open Terminal using Spotlight. Press Cmd + Space key and it will open Spotlight. Now type Terminal and hit enter.

Or, you can go to Finder then click on Applications then go inside the Utilities folder and select Terminal.

Create Zip Mac Terminal

Step 2: Go to source folder location

Now go inside the folder (directory) in which you have the confidential folder that you want to encrypt.

I have my confidential folder (name: TopSecret) on my Desktop so I will go to Desktop by typing the following command in the Terminal

Step 3: Encrypt Folder

To encrypt a folder we have to type the following command in Terminal.

Where, zip is the command to create zip files.


DESTINATION_FILENAME is the name that you want to give to your zip file. SOURCE_FILENAME is the name of your folder that you want to zip.

The -er option will create an encrypted zip file using the source folder and its content.

I will go ahead and create an encrypted zip file using the TopSecret folder that is on my Desktop. I will name my zip file as

It will prompt you to enter a password to encrypt the file. Enter a strong password to proceed.

Create Zip Mac Terminal Online

Next, it will prompt you to verify the password that you have entered. Re-type the password and it will create a zip file for you.

Create Zip Mac Terminal

Step 4: Unzip

Create Zip Mac Terminal

To unzip the encrypted zip file all you have to do is double-click on the zip file and it will prompt you to enter the password that was used for encryption.

Mac Terminal Alternative

Enter a valid password and it will successfully decrypt and unzip the zip file for you.

DANGER If you forget the password then you will be unable to extract the files.

Create Zip Mac Terminal Free

Hope you will find this tutorial helpful. Please share this with your friends on social media. Thanks for reading. Have fun :)