Zip is a famous archive format used in most operating systems; it is quite simple to zip and unzip files or folders on Linux.
Please follow the steps listed below to zip and unzip files and folders on any Linux VPS.
Note: Before referring to the following steps, ensure you have sudo or root privileges on the OS.
Step 1: First, install the zip on the VPS.
# sudo yum install zip unzip -y (CentOS/RHEL/AlmaLinux 7)
# sudo dnf install zip unzip -y (Fedora/AlmaLinux 8/9)
# sudo apt install zip unzip -y (Ubuntu/Debian)
Step 2: Now, zip the files created in the /home directory. We have three files in the /home directory: data.sql, data1.sql, and data2.sql. We will add these three files in a single zip using the below-given command and the newly created data.zip.
# zip archive.zip data.sql data1.sql data2.sql
Step 3: To verify that the created zip has the files that we have compressed in a zip, we can run the following command:
# unzip -l archive.zip
Step 4: We can run this command to unzip the files inside the zip:
# unzip archive.zip
