How can I view the list of files in a ZIP archive without decompressing it?
You can make the zip appear as a directory (in which you use
ls, etc.) by mounting it with the fuse-zip virtual filesystem.
mkdir foo.d fuse-zip foo.zip foo.d ls foo.d cat foo.d/README ... fusermount -u foo.d rmdir foo.d
Another relevant FUSE filesystem is AVFS. It creates a view of your entire directory hierarchy where all archives have an associated directory (same name with
# tacked on at the end) that appears to hold the archive content.
mountavfs ls ~/.avfs/$PWD/foo.zip\# cat ~/.avfs/$PWD/foo.zip\#/README ... umountavfs
Many modern file managers (e.g. Nautilus, Dolphin) show archive contents transparently.
AVFS is read-only. Fuse-zip is read-write, but beware that changes are only written to the zip file at unmount time, so don't start reading the archive expecting it to be modified until
fusermount -u returns.
A more comprehensive solution: vim || emacs
The previous answer by @kinORnirvana is my favorite to produce a file with the content of a zip archive.
zipinfo [-1] archive.zip > archive_content.txt
However, I recommend vim or emacs (not nano) if you need to browse into an archive file or even to view the content of a file contained inside it.
This approach works with other archive formats too:
vim file.tar vim file.tar.gz vim file.tar.bz2
With vim or emacs you can:
- browse the directory structure of the archive file.
- view the content of any file inside the archive file.