How to Unzip zip files in CentOS
Installing unzip on CentOS 7:
On CentOS 7, the unzip package may not be installed by default. But it is available in the official package repository of CentOS 7. So it is very easy to install.
First update the YUM package repository cache with the following command:
#sudo yum makecache
Now install unzip with the following command:
check whether unzip works, run the following command:
Listing the Contents of the Zip file using unzip Command:
You can list all the files and directories stored inside a Zip file with the following command:
$ unzip -l app.zip
Extracting a Zip File using unzip Command:
You can extract a Zip file using the unzip command very easily.
To extract a Zip file into the current directory where the zip file is, run the following command:
$ unzip app.zip
Unzip zip files in command line in CentOS
To unzip a zip folder, use the unzip command followed by the name of the zip file.
unzip file.zip
The unzip command in CentOS will unzip the zip file to the current working directory.
Unzip zip file to specific directory
With -d
option we can specify the directory, which we want to extract files.
unzip -d /tmp file.zip
This time CentOS unzip command will extract the zip file to the /tmp directory.