How to Unzip a File in Linux/Ubuntu

File compression can be accomplished in many different ways on a Linux system. The easiest way to determine which method to use to de-compress your file is to look at the extension.

If your extension is .zip, then you can use the instructions below to de-compress your files. If your extension is .tar, .tar-gz, or .gz, you can use our other how-to article.

Using the zip/unzip Method to Unzip

On Debian/Ubuntu, you can use the following commands to install zip/unzip:

To unzip files or directories (photos.zip), use:

Options When Unzipping Your Files

There are a few options worthy of noting with the unzip command:

Let’s say we wanted a single image1.png from our photos.zip.

What if we want to unzip our files to a different directory (named ./directory/)?

If you are unsure of the integrity of the zip file and just want to test it, you can use the -t flag.

If we wanted to just list the files in a zip file, we can use a simple command.

If you run into trouble, the unzip man page is a great resource.

Ryan Frankel

Questions or Comments? Ask Ryan!

Ask a question and Ryan will respond to you. We strive to provide the best advice on the net and we are here to help you in any way we can.

  • ernest

    thanks man.

    • frankel0

      No problem Ernest. I hope you found the article helpful.

  • harsh sarode

    hi guys,
    I want to download a zip file from url and extract it into a specific directory by ubuntu terminal by linux command.i unable to do so.plz help.

    • frankel0

      You can try wget to download the file, and then just use the unzip procedure above to unzip the file.

      > wget http://yoururl.com
      > unzip yourfiledownload.zip

  • Dharani

    Hello Ryan,

    Can you please throw some light on the permissions aspect when you unzip a archive containing several directories and files?

    I seem to come across a weird situation:

    In the first instance, I upload a zip archive onto the linux server and use unzip command from a ssh shell.
    Second time, I unzip in windows (local PC) and using ftp client (filezilla) upload all the extracted files and directories to the server.

    There seems to be some discrepancy in the method 1 above. I am just perplexed, Can you help me please?