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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
Extract all files from current folder, you can use: unzip \*.zip – burtsevyg Feb 18 at 11:23
up vote 746 down vote accepted

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 -d destination_folder
share|improve this answer
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
unzip may be a default program. In other words, you may not need to install it. – noobninja May 31 at 19:33

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 '15 at 22:17
For some unzip is more useful: easy to use and its Name to remember. – Shy Robbiani Jan 20 at 7:25

You can use:

unzip -d somedir

to extract to yourpath/somedir

If you want to extract to a non-relative path, use

sudo unzip -d /somedir
share|improve this answer

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

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

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

protected by Eric Carvalho Sep 30 '15 at 12:07

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

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.