Escape the wildcard or quote it
unzip -l archive.zip | grep -i stage/components
The error message unzip: cannot find any matches for wildcard specification is a common frustration when working with ZIP archives in Linux, macOS, and other Unix-like command-line environments. It usually happens because your command line shell (like Bash or Zsh) tries to interpret the wildcard character ( * ) before passing it to the unzip utility.
Before running the unzip command, verify your current location and list the files to ensure the file exists. Example Debugging Workflow: Escape the wildcard or quote it unzip -l archive
Assuming listing shows:
When writing shell scripts that extract specific parts of a ZIP, follow these best practices:
In some CI/CD runners or macOS environments running Zsh, the shell is strictly configured to throw an error if a wildcard fails to match local files. If the shell searches your current directory and
The backslash tells the shell to treat the * literally. The unzip command then receives the literal string *.zip and expands it according to its own logic, successfully processing all matching archives.
If the shell searches your current directory and finds absolutely no files matching your wildcard pattern, it behaves in one of two ways depending on your configuration:
Use the unzip -l command to list the contents of the ZIP archive: successfully processing all matching archives.
| Cause | Solution | |-------|----------| | Space in path inside ZIP | Quote the entire path: "stage components/*" | | Shell expands wildcard before unzip | Quote wildcard: "stage/*" or stage/\* | | stage and components passed as two arguments | Merge with quotes or backslash space | | ZIP contents don't match pattern | Check unzip -l for exact casing and spelling | | Piped input to unzip | Write to temp file first | | Corrupted ZIP | Rezip using unzip + zip or use 7z |
unzip project.zip stage/components