Finding specific things
Neither Spotlight nor Finder looks inside a zip. The command line does, without extracting.
unzip -l archive.zip
unzip -l archive.zip | grep -i invoice
for z in *.zip; do
echo "== $z"
unzip -l "$z" | grep -i "invoice"
done
unzip -j archive.zip "path/inside/file.pdf" -d ~/Desktop
-j flattens the directory structure so the file lands directly in the destination.
tar -tf archive.tar.gz | grep -i invoice
tar -xzf archive.tar.gz path/inside/file.pdf
hdiutil attach -nobrowse -readonly image.dmg
find /Volumes/ImageName -iname "*invoice*"
hdiutil detach /Volumes/ImageName
-nobrowse keeps it out of Finder's sidebar while you look.
unzip -p archive.zip "*.txt" | grep -i "search term"
-p streams a file to stdout without writing it to disk.
Indexing archive contents means decompressing everything, and an archive can contain an archive. Storing that expands the index enormously for a case most people meet rarely, which is why essentially no search tool does it and the command line remains the answer.
No. It indexes the archive as one item. Use unzip -l to list contents.
hdiutil attach -nobrowse -readonly, search the mounted path, then hdiutil detach.
Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Download for Mac