TIP: How to unzip multiple files in Linux in one go


When you want to unzip a file in Linux, it’s straightforward – you do

What if you have multiple zip files to decompress? Intuition says that unzip *.zip should work. Right? Let’s see.. when I do that, I get the below message

 So, how do you do it? You put the wildcard expression in single quotes so that the shell doesn’t expand it, Lo and behold, we have a winner here. 🙂

Why do we have to do this in the first place? When we do unzip *.zip, because of how unzip is written, the shell will expand the *.zip part and pass to unzip.

So your *.zip will become 001.zip and 002.zip, which translates into unzip 001.zip 002.zip. This, if you look at the man page for unzip translates to unzip 002.zip from 001.zip 🙂 No wonder it said

 

Leave a comment

Your email address will not be published. Required fields are marked *