Commands.page Logo

How to Password Protect Zip Archive Ubuntu Terminal

This guide explains how to secure your files by creating a password-protected zip archive directly from the Ubuntu terminal. You will learn the specific commands required to compress data and apply encryption using standard tools available in the Linux environment, ensuring your sensitive information remains private during storage or transfer.

To begin, ensure the zip utility is installed on your system. Open your terminal and run the following command to install it if it is not already present:

sudo apt install zip

Once installed, navigate to the directory containing the files you wish to compress. Use the zip command with the -e flag to enable encryption. The basic syntax is:

zip -e archive_name.zip file_to_compress

Replace archive_name.zip with your desired filename and file_to_compress with the actual file or folder path. When you execute this command, the terminal will prompt you to enter a password. Type your chosen password and press Enter. Note that the characters will not appear on the screen as you type for security reasons. You will be asked to verify the password by entering it a second time.

After verification, the encrypted archive is created. To access the files later, you will need to unzip the archive using the unzip command, which will prompt you for the password you set:

unzip archive_name.zip

This method provides a quick way to add a layer of security to your compressed files using native Ubuntu command-line tools.