How to unzip a zip file from the Terminal?
Just downloaded a .zip file from the internet. I want to use the terminal to unzip the file. What is the correct way to do this?
Solution 1:
If the unzip
command isn't already installed on your system, then run:
sudo apt-get install unzip
After installing the unzip utility, if you want to extract to a particular destination folder, you can use:
unzip file.zip -d destination_folder
If the source and destination directories are the same, you can simply do:
unzip file.zip
Solution 2:
You can simply use unzip
.
Install it:
apt-get install unzip
And use it:
cd /path/to/file
unzip file.zip
Solution 3:
A more useful tool is 7z
, which zips and unzips a range of compression formats, notably lzma
, usually the protocol offering the highest compression rates.
This command installs 7z
:
sudo apt-get install p7zip-full
This command lists the contents of the zip:
7z l zipfile.zip
This command extracts the contents of the zip:
7z x zipfile.zip