How to zip files and folders On Ubuntu

How to zip files and folders On Ubuntu

Today we will learn How to zip files and folders On Ubuntu. Encountering ZIP files usually tempts us to archive the files in a folder, as we can save disk space and network bandwidth. Zip files and folders in Ubuntu helps us to compress multiple files into one. But you might not know how. This article reviews convenient methods to zip files and folders in Ubuntu.

How to Zip a File On Ubuntu

The standard tar and gzip utilities create many Ubuntu Linux file archives with the “tar.gz” extension. Although gzip has the same name as Windows’ built-in file extractor, PKUNZIP, WinZip, or 7-Zip, it doesn’t produce compressed archives compatible with these utilities. Linux and non-Linux systems, like Windows and Mac OS X, can extract standard archives created by Ubuntu’s zip command-line utility.

Follow these steps to extract the zip file in Ubuntu:

Step 1:

Tap the “dash” icon and in the search box, type “terminal”. The “Terminal” application icon will appear. Click on it.

Step 2:

Use the “cd” command to navigate to the folder of the zip file. When you are at the command prompt, type “cd Documents” and press enter if your file is in the “Documents” folder.

Step 3:

Ubuntu’s terminal command line allows you to create a zip archive, add files to the archive, and create the zip archive by typing the “zip” command. For example, to create a ZIP archive named “moneydocs” containing the file “bank.doc”, type the following commands at a terminal prompt and then press the “Enter” key:

zip moneydocs bank.doc

Step 4:

Now you need to make sure that your zip file is created. To do this, type “ls *.zip” at the command prompt. Then tap the “Enter” key.

How to Zip a Folder On Ubuntu

In addition to creating a zip file, compressing a folder in zip format is essential for sharing multiple files with someone else.

Zip folders are offered in the operating system to prevent the loss of our data, so you need to learn how to zip a folder in Ubuntu. 2The 2 methods to zip a folder in Ubuntu are using the GNOME graphical interface environment and the command line. First, let’s start with the command line zipping method:

1. zip folder in Ubuntu using command line

To zip a folder in Ubuntu, you must have the zip command-line utility installed on your system, as it is required for file compression. So, before doing anything, check if it is installed on your system. Most Linux distributions do not have a default installation of this zip utility.

If you want to install the zip command-line utility, you can use the Ubuntu official app repository. Typing below-mentioned command helps you to install it:

$ sudo apt update

$ sudo apt install zip

Now that you have installed the zip utility, check the installed version by running the command:

$ zip –version

You can also zip a folder with the zip utility using the following syntax:

$ zip options archive-name.zip folder-name

For example, if you want to zip a folder named ‘MyFolder’, the following syntax will create a zip archive of this folder:

$ zip -r MyFolder.zip MyFolder

After all the files are successfully compiled with the zip utility and added to the .zip archive, the contents of the directory will be displayed in the terminal.

How to Zip Multiple Folders in Ubuntu

Many files and directories can be included in the same zip archive, as well as multiple directories and folders. If you want to create more than one zip archive, use the following command:

$ zip -r archivefolder.zip MyFolder1 MyFolder2 file1.txt file2.txt

$ zip -r MyDocsFolder.zip MyDocsFolder PersonalFolder file1.txt file2.txt file3.txt

How to Create a Zip File with Password in Ubuntu

You may have personal or sensitive files and information that you want to keep safe. We specify a command that requires a verification password to access files. To save your personal files, use this command:

 $ zip -e archivename.zip directory_name

Create Split Zip File in Ubuntu

Sometimes, you need to upload files of only 100 kb size to another server or file hosting service For example, you have 2 MB of data to upload, but it only supports 100 kb files.

By using the ‘-s’ option, you can create a split archive file following the specified archive file size limit. When you reach the specified archive file size limit, the command below creates a new zip archive file in the home directory.

$ zip -s 100k -r archivename.zip directory_name

2. Zip folder in Ubuntu using Gnome GUI

Another method to zip a folder in Ubuntu is to use the GNOME graphical desktop environment. If you cannot use the command line, perform the following steps:

  • You can zip a folder using Gnome Desktop and navigate to that folder.
  • Select the folder by right-clicking on it. A drop-down list will appear; Choose the ‘Compress’ option from the list.
  • Press on ‘Create’ after selecting the ‘.zip’ extension and giving the zip archive a suitable name.

Now you can see that the compressed archive has been created in the current directory where the main folder is located.

Conclusion

Compressing files always helps us save disk space and bandwidth. It is also useful for sharing multiple files with others in a convenient manner. Now you can zip files and folders in Ubuntu as we have explained the methods to create them using the command line and the GNOME graphical desktop environment. To choose a suitable method, you must consider your requirements. I hope the information on zipping a folder using the zip command is helpful to you.

Scroll to Top