How to Unzip Multiple Files with the Command Line

It can be a bit tricky to unzip multiple files using the command line

Recently, I downloaded a lot of ZIP files from the internet to my Raspberry Pi. After all the downloads finished, I listed the files and tried to unzip them all. My first instinct was to type unzip *.zip, just like other standard Unix commands (rm, cp, etc.). But to my surprise, it didn’t work at all.

Take a look at the following snippet. This is an example of the output I get when I try to unzip multiple ZIP files using the wrong command.

$ unzip *.zip
Archive:  file-01.zip
caution: filename not matched:  file-02.zip
caution: filename not matched:  file-03.zip

So, how do you solve this problem?

It’s actually pretty simple—just wrap *.zip in single quotes ('), as shown below.

unzip '*.zip'

Now that the command is written correctly, here is the expected output.

$ unzip '*.zip'
Archive:  file-01.zip
  inflating: file-01.iso

Archive:  file-02.zip
  inflating: file-02.iso

Archive:  file-03.zip
  inflating: file-03.iso

3 archives were successfully processed.

Success!

I also made a video to help visualize what I explained here.

Thank you for reading. See you in my next tutorial.

References