Zip is a famous archive format and it is used in most operating systems. It is very easy to zip and unzip files or folders on Linux. Please refer to the following steps to zip and unzip files and folders on Centos.
Before referring to the following steps, make sure you have sudo or root privileges on the OS.
- First of all, let us install zip on Centos.
sudo yum update
sudo yum install zip unzip -y - Now, let us zip the files that are created in /home directory. We have 3 files lying inside /home directory that are data.sql, data1.sql and data2.sql. We will add these 3 files in a single zip using the below command and newly created named data.zip
zip data.zip data.sql data1.sql data2.sql
- To verify the created zip has the files that we have compressed in a zip, we can run the below command.
unzip -l data.zip
- We can run the below command to unzip the files inside zip.
unzip data.zip