Linux being an open source operating system allows various ways to zip files. In this guide, you will learn about the methods you can use to zip files on Linux . So let’s start the guide.
How to zip files in Linux Terminal
By default, Linux OS comes with zip file support. But checking it is no harm. To check if you have support for zip, run following command in terminal.
sudo apt install zip unzip
When you are done, run the following command in terminal, to create zip file.
zip output_filename file1 file2...
Second argument of the command is filename of the zip created as a result of this command, the arguments after it are all the filenames which you want to add to the zip file.
Password protected zip on Linux Terminal
To create password protected zip use the following command.
zip -p filename.zip files_to_add
The second argument of this command is -p which will allow you to enter password for the zip file.
Using terminal is not a pleasant experience for every Linux user, therefore, I would like to guide about Graphical User Interface method for zipping in Linux.
- Locate the file(s) which you want to zip.
- Select the files and right click with mouse.
- From the menu, click on compress.
- Done. You have successfully created zip file for the selected files or folders.
We will also guide you on how to make password protected zip on Linux.
How to make password protected zip on Linux GUI
- All the steps from 1 to 3 are same as above guide, but, to ensure a password protected file, click on others option to explore more options about the zip file.
- Here you will option to set any password for zip file.
- Enter the desired password and click on Create.
BZIP2 is another utility distributed in Linux Operating systems. It is faster than GZIP but requires more ram to compress the files.
bzip2 -z file.txt
GZIP not only provides utility to compress the files but also support uncompressing.