How to unzip a zip file using Terminal on Ubuntu/Linux machine?
Use the unzip
command to unzip a zip file on a Ubuntu/Linux machine.
Check if the machine already has the unzip utility installed, else install it and then try to unzip a zip file as shown below.
Use the below command and check if unzip utility is among the list of installed packages or applications listed.
sudo apt list --installed
Use the below command to update the local package index before installing a new package or an application.
sudo apt update
Use the below command to install unzip utility.
sudo apt install unzip
Use the below command to extract or unzip a zip file.
The below command will extract the zip file contents to the same location, where the zip file is located.
unzip filename.zip
In case, if we want to extract the zip file contents to a specific destination location, then use the below command.
unzip filename.zip -d /path/to/dest_folder
Use the below commands to extract or unzip a zip file, using absolute paths.
Let's assume, your current working directory is /var/www
and you want to extract the file /var/www/sample.zip
to a destination folder /var/www/extract
, then use the below commands.
Using relative paths.
unzip sample.zip -d extract
Using absolute paths
unzip /var/www/sample.zip -d /var/www/extract