A great approach to organizing data on your computer and conserving storage is through folder compression. Here’s how to add directories to a Linux zip package. The archive file type ZIP is very helpful for managing and storing files. You can distribute several files and folders effectively by combining them into a single file by using an effective zipping tool.
Linux users may conserve a lot of disk space and network bandwidth by zipping folders. Since its creation in 1989, ZIP has grown to be one of the most used methods for data compression and file size reduction. On Linux-based computers, you can easily zip a folder using several native commands like zipping.
How to Install zip on Linux
You won’t typically find the zip utility pre-installed on your Linux machine. Use the default package manager provided by your distribution to install zip.
- on Debian and Ubuntu
- Using CentOS and Fedora, install zip.
- Manjaro and Arch Linux
- For OpenSUSE, enter the following command to install zip.
How Does the Zipping Process Work?
The tool begins scanning the input-specified files as soon as the zip command is executed. The zip command will show the following warning if the scan takes longer than five seconds: Scanning files. What’s fascinating is how you, the user, can comprehend what’s going on in the backend. The result indicates that the files are being processed if progress dots appear every two seconds.
If more than two seconds have passed, either the network connection is slow or the command is taking a while to find the files. The zip will offer a warning if it cannot find a certain file but will nonetheless carry out your request. The command will then send a warning at the conclusion, notifying you of how many files it processed and how many it skipped in case some were skipped during the process.
Zipping a Folder Using the Command Line
where folder1, folder2, and folder3 are the absolute or relative paths to the directories, and the output file is the name of the archive. Try saving the data folder as a zip file with the name temp.zip. Run this command to accomplish that:
Use the Is command to verify that the archive was successfully created after executing the aforementioned command. The file will not be compressed if the zip command finds that it is too large to store in the archive.
Read More: A Complete Guide on How to Fix Connection Refused Error in Linux Easily!
1. Specifying Compression Levels
The -Z switch allows you to define the compression algorithm. Each file that is added to the archive will have its compression levels displayed in the output. You can also specify the compression levels by using numbers between 0 and 9. Use -0 instead of the default value of -6 to save files without compression. However, -9 will compel the zip command to apply the best compression to every file contained in the archive.
2. Zipping a Folder Using the find
The search command can be used efficiently to compress a folder with an unknown path. In order to run the zip command and create an archive, the first pipe finds the exec command. Run the following command to zip up any folders in the current working directory:
This option is quite useful since it gives you the freedom to select archive folders recursively. You can also decide how many folders in your archive should be compressed.
3. Using the GUI for Zipping Folders
Almost all Linux desktop environments provide a zip file functionality. Despite the fact that this instruction focuses on Ubuntu, other Linux distributions will likely follow a similar process. Open the file management program on your computer from the Applications menu to produce a compressed (zipped) file using the graphical user interface. Select the folders you want to compress after the window opens. Keep the Ctrl key depressed when clicking on numerous folders to select them all.
Read More: How to Block Youtube Ads in Android in A Few Easy Steps?
4. Compress files using Linux GUI
After that, right-click any folder to reveal a menu. choosing the Compress button The following will be requested of you in the dialog box:
- Record name
- Format of Archives (options include ZIP, TAR.XZ, and 7Z)
- Hit the Create button up top after entering the name and choosing the kind of compressed file.
Save Storage on Linux by Compressing Folders
Considering the intricacy of other utilities in the Linux ecosystem, the zip command is quite simple to use. While using a GUI is easy and seamless, using a terminal is also a viable option. If you know the appropriate commands to use, using a terminal is not particularly challenging.