How to Protect Zip file with Password on Ubuntu

Protect your compressed zip file with a password on Linux is pretty easy. There are several ways and tools to protect your file with a password on Linux.

In this tutorial, we will show you how to protect zip file with a password using the command line and GUI on Ubuntu 22.04.


  • Ubuntu 22.04 Desktop installed in your system.
  • A normal user with sudo privileges.

Create Password Protected Zip file from Command Line

First, you will need to install zip and unzip packages on your system. You can install both packages with the following command:

sudo apt-get install zip unzip -y

First, create a sample file that you want to encrypt.

nano test1

Add some content:

This is my first password protected zip file

Save and close the file.

Next, create a zip archive with a password by running the following command:

zip --encrypt test1

You will be prompt to enter the password as shown below:

Enter password: 
Verify password: 
  adding: test1 (deflated 2%)

Now, try to unzip the password-protected zip file:


You will need to provide a password in order to unzip the file:

[] test1 password: 
  inflating: test1    

Create Password Protected Zip file from GUI

You can also create a password-protected zip file from the graphical environment.

To do so, right-click on the file you want to secure and click on the Compress:

Create a .zip file in GNOME

Now, select the compression format and click on the Other Options. You should see the following page:

Set a password for the zip file

Now, provide the password and click on the Create button. Once the file compressed successfully, you should see the newly created zip file in the following page:

Zip file created successfully

Zip file in Ubuntu File explorer

To unzip the file, right-click on the zip file and click on the Extract Here button. You will be prompt to enter the password. Provide the password and click on the Ok button to finish.

Extract password protected file

This tutorial taught us how to create a password-protected zip file on Ubuntu 18.04 with a command line and graphical environment.

Share this page:

Suggested articles

3 Comment(s)

Add comment


By: doug

This is exactly what I want to do! - problem is, it doesn't work. :( I am running 18.04, but when I click compress, it only gives me options for .zip, .tar.xz, and .7z.

Any ideas? Thanks. :)

By: Nour

in Ubuntu 18.04 there is not any more the option to select a password as it is used to be in Ubuntu 16.04

By: admin1234

if you open the zip after compressing and then click the 3 bar menu, select "password" you can then encrypt it when you click saveubuntu 18+++ is going all windows by hiding essential things to make it look firefox won't let you diasble update checks now, the old days are over the snoopers won.