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 CentOS.
Note
Before referring to the following steps, ensure you have sudo or root privileges on the OS.
1. First, install the zip on CentOS.
sudo yum update
sudo yum install zip unzip -y
2. Now, zip the files created in the /home directory.
We have three files in the /home directory that are 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 data.zip data.sql data1.sql data2.sql
3. To verify that the created zip has the files that we have compressed in a zip, we can run the below command –
unzip -l data.zip
4. We can run this command to unzip the files inside the zip –
unzip data.zip