How do I unzip multiple / many files under Linux?

I have lots of files in a directory called /disk2/images/. All files are in zip file format, so I am using the following command to extract zip files:
     unzip *.zip
The command result into an error which read as follows:
     caution: filename not matched
How do I unzip multiple or many zip files under a Linux/Unix-like system?

Linux or Unix-like system use the unzip command to list, test, or extract files from a ZIP archive, commonly found on MS-DOS systems.

The problem with multiple zip files on Linux

Assuming that you have four file in a /disk2/images/ directory as follows:


Let us verify it with the ls command:
$ ls
Sample outputs:

To unzip all files, enter:
$ unzip *.zip
Sample outputs:

caution: filename not matched:
caution: filename not matched:
caution: filename not matched:

Above error indicate that you used the unzip command wrongly. It means extract,, and files from inside the archive. Your shell expands the command ‘unzip *.zip’ it as follows:
The solution is pretty simple when you want to unzip the file using the wild card; you have two options as follows.

#1: Unzip Multiple Files Using Single Quote (short version)

The syntax is as follows to unzip multiple files from Linux command line:

unzip '*.zip'

Type the following command as follows:
$ cd /disk2/images/
$ unzip '*.zip'
$ ls -l

Note: *.zip is put in between two single quotes so that shell will not recognize it as a wild card character.

#2: Unzip Multiple Files from Linux Command Line Using Shell For Loop (Long Version)

You can also use for loop as follows:

 for z in *.zip; do unzip $z; done
See also

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 28 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
28 comments… add one
  • Kamchybek Jusupov Mar 6, 2007 @ 9:39

    # If files are password protected, and we are not sure which password

    for Z_FILE in *.zip; do
    for PASSWD in [ pass123, PASS123, abc123, ABC123 ]; do
    unzip -P $PASSWD $Z_FILE;
    if [ $? = 0 ]; then # successful unzip

  • 🐧 Vivek Gite Mar 6, 2007 @ 10:52


    This is an excellent hack.

    Appreciate your post.

  • Kamchybek Jusupov Mar 21, 2007 @ 10:11

    > Appreciate your post.

    No probs, copyleft (c) :)

    Actually I’ve seen yours:

    $ for z in *.zip; do unzip $z; done

    But, it was not enough for me, ’cause we have password protected ones… So, can say that idea comes from you :) I just added a new feature (validation)…

    I think it should/can be improved further to check for other exit status codes…

    Maybe later some day…

  • Bobby Cox Apr 8, 2007 @ 2:54

    I used to use for i in *.zip ; do unzip $i ; done as well but then I found out about the following command and use it all the time now.

    unzip \*.zip

    escape the asterik and you are good to go. :)

  • Naresh Jul 26, 2007 @ 9:43


    I tried unzip -P $PASSWD $Z_FILE; command but it is not working and for same zip file it is working in US with same password. I read in one of the web sites that, non USA system needs to install a patch for running above command. If yes Please let me know where can I get this patch else please let me know how to run this command.


  • Oberg Jan 24, 2009 @ 16:05

    Thanks, just what I needed! Very straitghtforward. +1 virtual cookie for you.

  • some dude Apr 25, 2009 @ 7:04

    If you have spaces in your filenames, you can also use the following:

    for z in *.zip; do unzip “$z”; done

  • Ragu May 11, 2009 @ 20:52

    find -name \*.zip -exec unzip {} \;

    find -name \*.zip | xargs -t -i unzip {}

  • moshe beeri May 31, 2009 @ 12:08

    If you like to extract multiple tar or tar.gz use the following command
    for f in *.tar.gz; do tar zxf $f; done

  • Kaithy Aravind Reddy Dec 27, 2009 @ 4:30

    Thanks all for sharing, very useful information about Unzip.

  • eladio matos Feb 18, 2010 @ 18:01

    Question: and if I want do delete a file in a batch of different compressed archives? Lets say all copies of “info.txt” or “logo.jpg” in,,…), etc. There is a way to do it?

  • vipin kumar Jan 12, 2012 @ 5:26

    excellent post …. short method is really awesome..

  • Jane Jan 16, 2012 @ 12:41

    Exactly what I was looking for! THANK YOU!

  • Paul Feb 21, 2012 @ 12:10

    Time saver, life saver! Thank you!

  • pradeep chourasiya May 22, 2012 @ 5:52

    thanks a lot …..4 help

    if u want to display some msg then…

    for z in *.zip;
    do unzip $z;
  • Radina Oct 23, 2012 @ 17:37

    Thanks everyone for the answers. If space is an issue, you can do something like (from some dude) to remove the archive files as they are unpackaged:
    for z in *.zip; do unzip $z; rm $z; done

  • sarita Nov 3, 2013 @ 4:54

    I have 1..10 zip files in one directory …i want to unzip all files at a time..
    can any one help how to do that

  • Tarun Nagpal Jan 26, 2014 @ 12:39

    Thank you very much.

  • Tony Sep 13, 2014 @ 18:07

    I used:

    unzip “*.zip” -d ~/.fonts/

  • Speppa Jan 29, 2015 @ 9:08

    Thank you very much, on my Debian option #2 works very well!

  • LeQuebecois-rigolo Jan 19, 2016 @ 8:06

    I had a pile of zip that each contained a index.html file and the archive structure had no folder.. They obviously had to be extracted in separate folders so as to not overwrite the so precious files. Since it was a temporary “view and delete” kind of thing and with well over a hundred files (not needing to be unzipped in a specific folder, current folder was just fine), i came up with this;

    for z in *.zip; do q=$(echo $z | cut -f 1 -d '.'); unzip $z -d ./$q; done;

    It basically extracts all the zip files to the current directory, into a folder named after the zip filename. Greatly inspired (if not totally ripped from!) NixCraft and

    Couple seconds after i figured “oh well”, i saved that much time so i might as well make something out of it… So instead of just ‘hardcoding’ it into a simple bash alias that doesn’t take parameters, I took a couple more minutes to have it let me at least input a base directory for extraction. Here’s what i came up with (function in .bashrc file);

    unzipALL() {
    [[ ! -z "${1// }" ]] && dir=$1;
    for z in *.zip; do
    q=$(echo $z | cut -f 1 -d '.');
    unzip $z -d $dir/$q;

    From the command line just use unzipAll to unzip to the current folder or pass it a folder name: unzipAll /tmp extracts all to /tmp/%filename%.

    It does perform a single basic check on the passed parameter but nothing too fancy (strip spaces before/after then checks against null). One could spend more time and cutomize it further, adding bad directory check and all that…

    I figure i’d share… thanks and hopefuly it can be of use to someone!

    I hope i didn’t break any rules posting a url in here, sorry if so heeh

    • 🐧 Vivek Gite Jan 19, 2016 @ 12:04

      Awesome job and thanks for sharing it with us.

  • Nan Xiao Jan 20, 2016 @ 2:25

    unzip “*.zip” should also be OK.

    • LeQuebecois-rigolo Jan 21, 2016 @ 2:30

      unzip *.zip does not work in bash.

      blah@blahblah:~/tmp-zip$ unzip *.zip
      caution: filename not matched:

      unzip \*.zip DOES work, still doesn’t solve the problem i faced of multiple same-name files…

      blah@blahblah:~/tmp-zip$ unzip \*.zip
      inflating: index.html
      inflating: portfolio.html
      inflating: services.html
      replace index.html? [y]es, [n]o, [A]ll, [N]one, [r]ename:

      unzip “*.zip” results in the same, btw.

      Hence the quick function. If you have a better way please share
      Also, while testing you assumptions, i found out that unzip tries to look for .ZIP files on it’s own – pretty neat… unzip \* would work (still not help with the issue…)

  • Thomas Jan 28, 2016 @ 16:00

    I just pulled a lot of files (over 400K) all of them were in zip, i’m trying to make huge archive off free documents at , so for me worked # unzip \*.zip , all that 400K went ok :) , so again, You can use unzip \*.zip , Good luck

  • PKaran Jan 29, 2016 @ 12:09

    I want a script to extract a particular file from the multiple zip folder.


  • David Jun 14, 2016 @ 21:40

    unzip \*.zip

  • Himanshu Jan 6, 2017 @ 21:50

    What should be the command to unzip all the files with a single command if the extension is .gz?

    I used the above unzip ‘*.gz’.But it doesn’t work.

    Archive: zid_ia_rcvbl_acct_eecucl.skp.gz
    End-of-central-directory signature not found. Either this file is not
    a zipfile, or it constitutes one disk of a multi-part archive. In the
    latter case the central directory and zipfile comment will be found on
    the last disk(s) of this archive.

    168 files had no zipfile directory.
    No zipfiles found.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum