This site contains affiliate links. If you make a purchase, we may earn a commission.

How To Unzip Files Using Command Line (Multiple Ways!)



Hey there, jungle friends! Has a big .zip file got you swinging from the trees in frustration? Well, hang in there! Your favorite tech-savvy monkey is here to show you how to unzip files using the command line. It’s as easy as cracking open a nut, and much more fun than a barrel of monkeys. So, let’s get started and tame those wild files!

Table of contents

Video guide showing how to use terminal to unzip files.

How To Unzip Files on Linux and macOS

In the wild world of Linux and macOS, it can sometimes feel like you’re lost in the undergrowth. But don’t worry, we’re here to guide you through. Here’s how you can unzip files using the command line:

  1. Open Terminal on Directory: Open up your file manager and find the directory where your rar archive is located. Click the three dots and click on (Open in terminal). It’s like the tree where all the magic happens.

    How To Unzip Files on Linux and macOS: Step 1

  2. Unzip the File: No more monkeying with file sizes! It’s time to unzip the file. Use the unzip command followed by the name of your .zip file. For example, if your .zip file is named file.zip, you would type

    unzip file.zip

    How To Unzip Files on Linux and macOS: Step 2How To Unzip Files on Linux and macOS: Step 2

How To Unzip to a Different Folder

Want to unzip your files to a different tree… I mean, folder? Here’s how:

  1. Unzip to Specific Folder: Use the -d switch followed by the destination directory. For example,

    unzip file.zip -d /path/to/destination/folder

    How To Unzip to a Different Folder: Step 1How To Unzip to a Different Folder: Step 1

How To List Contents Without Unzipping

Curious to see what’s inside the .zip file without unzipping it? It’s like peeking inside a nut without cracking it open!

  1. List Contents: Use the -l switch. For example,

    unzip -l file.zip

    How To List Contents Without Unzipping: Step 1 How To List Contents Without Unzipping: Step 1

How To Extract Only Specific Files

Want to extract only a specific file from the .zip file? It’s like picking your favorite fruit from the bunch!

  1. Extract Specific File: After the .zip file, add the name of the file you want to extract, preceded by the zip file name. For example,

    unzip ezyzip.zip ezyzip/file_to_extract.txt

    How To Extract Only Specific Files: Step 1How To Extract Only Specific Files: Step 1

How To Unzip Split Zip Files

Got a .zip file that’s split into smaller parts? It’s like having a bunch of baby monkeys to take care of!

Split zip files, also known as multi-part zip files, are essentially a single zip file that has been divided into multiple smaller files. This is often done to accommodate size limits on email attachments or for uploading/downloading files from the internet.

When you have a split zip file, you’ll see that it has a number of parts with the same filename but different extensions. The first file in a sequence of split zip files will have the extension .zip or .z01, and the subsequent files will have extensions like .z02, .z03, and so on.

  1. Concatinate splitted zip file: First we will combine the split zip files into one combined zip file using cat command:

    cat split.z01 split.zip > combined.zip

    In this command:

    cat is a command that concatenates and displays files.

    split.z01 is the first file in the sequence of the split files.

    split.zip is then name of the split zip files.

    > is a redirection operator. It takes the output from the command on its left and directs it into the file on its right.

    combined.zip is the output file. This should be replaced with the name you want for your combined zip file.

    How To Unzip Split Zip Files: Step 1How To Unzip Split Zip Files: Step 1

  2. Unzip Split Files: Just unzip the concatinated file you just created and Voila!. For example,

    unzip combined.zip

    How To Unzip Split Zip Files: Step 2How To Unzip Split Zip Files: Step 2

How To Unzip Password-Protected Zip Files

Got a .zip file that’s locked up tighter than a banana in a monkey’s fist? Don’t worry, we can crack it open!

  1. Unzip Password-Protected File: Use the -P switch followed by the password. For example,

    unzip -P password file.zip

    How To Unzip Password-Protected Zip Files: Step 1 How To Unzip Password-Protected Zip Files: Step 1

    Remember, my fellow primates, practice makes perfect. So, keep cracking those .zip files until you become a pro! And remember, when it comes to archiving software, it’s a jungle out there, but you’re not alone. Your friendly neighborhood monkey is always here to help!