I am looking for a way to search the content of files inside of a 7-Zip archive (.7z) without having to unpack the archive. I have many 7-Zip archives with code inside them and I'd like to search them.

Is there a way to do that?

  • What Operating System? Aug 23, 2011 at 5:12
  • ditto. Though from what i can tell, there's no working way to mount a 7z archive in filesystem in linux, which would allow him to use the usual *nix file tools to search.
    – Journeyman Geek
    Aug 23, 2011 at 6:05
  • @Martin: search for which criteria? name? bytes inside the files stored in the .7z?
    – akira
    Aug 23, 2011 at 6:12
  • OS: Windows; Criteria example: "my string"
    – Martin
    Aug 23, 2011 at 12:59
  • There are a few utilities that do this very well. See newest answers. Sep 12, 2016 at 18:43

8 Answers 8


On Windows, use a command prompt:

cd C:\Program Files\7-Zip

To search for a specific file, e.g. namefile:

7z l compressed.tar namefile -r

Video tutorial: Search files with 7-Zip

  • 14
    Yes, this works, and it is quite fast, especially if there is not a lot of matches. But the folder where 7z.exe lives must be in PATH, for example C:\Program Files\7-Zip. However, it does not search the content of files, only the file names and thus does not answer the question. Mar 19, 2015 at 10:01
  • Damn fast, really good. It's a pitty that this function is not available in the gui. Jun 8, 2020 at 9:03
  • 1
    I second @PeterMortensen's comment: this does not answer the question, it only searches in filenames, not content.
    – Basj
    Sep 30, 2021 at 3:18

WinRAR can do it. However, let's face that fact it involves unpacking it, even though WinRAR does it seamlessly.

WinRAR, searching an archive


dnGrep is an excellent Windows grep implementation that has an archive file plugin that works with all archive formats. You can use Regex, Xpath, Text, or phonetic for your search.

  • Just installed this. When I try to run it, I see dnGREP.exe in the process list, but no GUI appears. Tried killing it and relaunching it to no effect. Will have to try something else. Feb 2, 2017 at 19:18

Try out SearchInZipFiles: It is a simple Open Source Tool for Windows located on Sourceforge:



On Windows, there exist a few utilities that can search the contents of files inside compressed archives with no decompression. Below are a couple of such products:

  • dnGrep
    Free and open-source, it can search zip, 7z, rar, jar, and many more archive formats. It also displays a preview of the found text in the files contained inside the archive. I tested it and it works as claimed.

    enter image description here

  • MythicSoft FileLocator Pro and Agent Ransack (commercial)
    Both products advertise their capability for searching compressed archives, but I have not tested it.


As others have said, no there is no way. To examine the contents of a file, it needs to be unpacked (regardless of if the files are compressed solid or not or if they are encrypted or not). The only way that you can avoid having to decompress the files is if they are added with the store method (ie, not compressed at all, just globbed together).


If you're on Linux with 7-Zip installed:

find . -iname *7z -exec 7zr -l \{\} \; | grep "filename.cpp"
  • 1
    That is still unpacking them. Although it is not possible to do what the OP wants without unpacking them, so...
    – EBGreen
    Aug 23, 2011 at 5:23
  • I'm in agreement with EBGreen. You gotta unpack them, unless you are ok with incomplete results.
    – surfasb
    Aug 23, 2011 at 5:38
  • 1
    Doesn’t that command just search for filenames? Martin wants to search inside the files themselves, not just their names.
    – Synetech
    Aug 23, 2011 at 5:43

It seems that it's not possible with 7z out-of-the-box, without decompressing it to a temporary storage.

I hope there is a nice solution that someone will post to solve this (thus the bounty I started).


  • it's possible for .gz files:

    zgrep "hello" foo.txt.gz
  • it's possible for .xz files:

    xzgrep "hello" foo.txt.xz

    See http://manpages.ubuntu.com/manpages/trusty/man1/xzgrep.1.html.

    Note that .xz files use the same compression algorithm than .7z, LZMA2, but it only compresses one file and not many files, except if you use tar (but that's out of topic here).

Conclusion: if you want to archive with a good compression ratio (similar to 7z), in a format that is searchable easily from command-line, use .xz instead of .7z.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .