Zip is perhaps the most popular compression method out of all the ones available.
Zip was created by Philip Katz in 1989 and is frequently used by system administrators to compress large files and directories on your computer.
Zip is now accessible for all major operating systems, including Windows, Linux, and macOS.
You can effortlessly move data between operating systems and conserve disc space with zipping.
In this lesson, we’ll look at how to use the zip command on Linux to simply zip files and directories.
Using zip, create a folder
On Linux, the simplest way to zip a folder is to use the “zip” command with the “-r” option, specifying the archive file as well as the folders to be included in the zip file.
If you wish to compress numerous directories in your zip file, you can specify multiple folders.
Let’s imagine you wish to archive the contents of a folder called “Documents” in a zip file called “temp.zip.”
$ zip -r <output_file> <folder_1> <folder_2> … <folder_n>
You would use the following command to accomplish this.
$ zip -r temp.zip Documents
You can check if your zip file was created by using the “ls” command and looking for your archive file.
$ ls -l | grep .zip
If you’re not sure where you saved your zip files earlier, you can use the find command to look for them.
$ find / -name *.zip 2> /dev/null
What do you think?