How to Unzip a File in Linux/Ubuntu

Unzip File Linuxubuntu

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:

sudo apt-get install zip unzip

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

unzip photos.zip

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.

unzip photos.zip image1.png

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

unzip photos.zip -d ./directory/

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

unzip -t photos.zip

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

unzip -l photos.zip

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

man unzip
Advertiser Disclosure

HostingAdvice.com is a free online resource that offers valuable content and comparison services to users. To keep this resource 100% free, we receive compensation from many of the offers listed on the site. Along with key review factors, this compensation may impact how and where products appear across the site (including, for example, the order in which they appear). HostingAdvice.com does not include the entire universe of available offers. Editorial opinions expressed on the site are strictly our own and are not provided, endorsed, or approved by advertisers.

Our Editorial Review Policy

Our site is committed to publishing independent, accurate content guided by strict editorial guidelines. Before articles and reviews are published on our site, they undergo a thorough review process performed by a team of independent editors and subject-matter experts to ensure the content’s accuracy, timeliness, and impartiality. Our editorial team is separate and independent of our site’s advertisers, and the opinions they express on our site are their own. To read more about our team members and their editorial backgrounds, please visit our site’s About page.