LinuxCommandLibrary

zipgrep

Search inside ZIP archives

TLDR

Search in ZIP

$ zipgrep [pattern] [archive.zip]
copy
Search specific file
$ zipgrep [pattern] [archive.zip] [file.txt]
copy
Case insensitive
$ zipgrep -i [pattern] [archive.zip]
copy
Show line numbers
$ zipgrep -n [pattern] [archive.zip]
copy
Count matches
$ zipgrep -c [pattern] [archive.zip]
copy
List matching files
$ zipgrep -l [pattern] [archive.zip]
copy

SYNOPSIS

zipgrep [-i] [-n] [-c] [-l] pattern zipfile [members]

DESCRIPTION

zipgrep searches for text patterns inside ZIP archives without requiring manual extraction. It works as a shell wrapper around unzip and egrep, piping decompressed file contents through pattern matching to display results in a familiar grep-like format.
Pattern matching supports extended regular expressions through egrep. The output shows the matching filename and line for each hit, similar to running grep on extracted contents. Optional member arguments restrict the search to specific files within the archive.
Standard grep options like -i for case-insensitive matching, -n for line numbers, -c for match counts, and -l for listing matching filenames are all supported. zipgrep is part of the Info-ZIP suite of utilities.

PARAMETERS

-i

Case insensitive.
-n
Show line numbers.
-c
Count matches.
-l
List files only.
-h
No filename prefix.
-v
Invert match.
pattern
Search pattern.
members
Specific files.

CAVEATS

Shell wrapper around unzip/egrep. May be slow on large archives. Part of Info-ZIP.

HISTORY

zipgrep is part of Info-ZIP utilities. It provides grep functionality for ZIP contents.

SEE ALSO

unzip(1), grep(1), zgrep(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community