The Computer Oracle

View list of files in ZIP archive on Linux

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Beneath the City Looping

--

Chapters
00:00 View List Of Files In Zip Archive On Linux
00:13 Answer 1 Score 208
00:30 Accepted Answer Score 801
00:46 Answer 3 Score 17
01:31 Answer 4 Score 70
01:42 Thank you

--

Full question
https://superuser.com/questions/216617/v...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #zip

#avk47



ACCEPTED ANSWER

Score 801


The less utility is capable of peeking into a zip archive. In fact, if you look at the outputs of unzip -l zipfile and less zipfile, you will find them to be identical.




ANSWER 2

Score 208


Try unzip -l files.zip Or unzip -l files.zip | less if there are too many files to be listed in one page.

Also, See man unzip for more options




ANSWER 3

Score 70


Please use

vim ZIP_FILE_NAME

for the same. This is a simple and easy to remember one.




ANSWER 4

Score 17


You can make the zip appear as a directory (in which you use cd, 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.