Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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?

share|improve this question

8 Answers 8

up vote 509 down vote accepted

If you want to extract to a particular destination folder, you can use:

unzip -d destination_folder
share|improve this answer
and sudo apt-get install unzip if needed. – Steve Bennett Jan 16 '13 at 0:37
If you are already in the directory you want the file unzipped, omit the 2nd and 3rd arguments, i.e. unzip /path/to/ – Severo Raz May 26 '13 at 19:13
I have just used this command. This is an example. Step 1 (I changed to the directory where the zip file is stored): cd /home/paf/Copy/Programming/Javascript/Json Step2 (I extract the zip file in the directory I have just mentioned): unzip -d /home/paf/Copy/Programming/Javascript/Json – pablofiumara Nov 12 '13 at 1:10
Is there also a "...and visit that folder in terminal" possibility of some kind? – Dualinity Feb 21 '14 at 11:06
Does this unzip -d destination_folder will also give all directory which start with .git and files . as start name ,Because this are hidden in Ubuntu .IF it will not extract them then how i can unzip them all from my zip file. – Herry Apr 5 '14 at 5:18

It is simple use unzip

share|improve this answer

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

This command extracts the contents of the zip:

7z x
share|improve this answer
7z e does not keep the directory structure - 7z x does... – assylias Oct 23 '13 at 12:59
13.10 says 7z does not exist. I think it must sudo apt-get install 7zip – nitishch Oct 26 '13 at 19:04
I think the install command should be sudo apt-get install p7zip or sudo apt-get install p7zip-full You need the full version to get the 7z command. The full is also the only one who handles zip and other kinds of formats out of the two. – Cort3z Oct 30 '13 at 20:15
could you clarify "A more useful tool"? Are you comparing to unzip? Could you provide any examples of features that make 7z more useful, and perhaps in which contexts 7z is preferred? – David LeBauer Sep 29 at 22:17

You can use:

unzip -d /Dir

or maybe if you want extract to a folder of the system you can do this:

sudo unzip -d /rootDir
share|improve this answer

In case your destination is same as the source zip file, you can simply do:

share|improve this answer

Unzip command will not work until you Install unzip. to install unzip just run below command, it works for me.

$ sudo apt-get install unzip
share|improve this answer

Here is the detailed description with options that i find useful:

Command: sudo unzip -[option] zip-path.  
                    -l List archive files.  
                    -t Test archive files with cyclic redundancy check.  
                    -u update the existing files.  
                    -z archive comment.  
share|improve this answer

Please install the unzip first using this command:

sudo apt-get install unzip

Then go to zip file directory using cd command

cd /path/to/dir

then type this command:

sudo unzip

You can also unzip a file into a directory of choice by using the '-d' flag:

sudo unzip -d /path/to/dir
share|improve this answer
Why would you use sudo to unzip without knowing if it's necessary? – muru Nov 19 '14 at 8:31
hi muru , you are right there are no need to use sudo command but if i wanat to unzip file in my home user directory then we will have to use sudo command to get the permission for the same. For eg . if i try to unzip my file in /var/www folder then without sudo command i could not extract my zip file.So there is no lose of user if he/she writes command with sudo .it works in every case. – user834799 Nov 19 '14 at 8:59
Then you should state that, like this answer has. – muru Nov 19 '14 at 9:03

protected by Eric Carvalho Sep 30 at 12:07

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.