163
26
How can I read the contents of a particular file in an archive without extracting the .zip it is contained within? I'm using the Linux command line.
An earlier question asks about viewing the directory of the archive. But for me it is not enough to see just a list of the files in the archive, I need to see the contents of a file in the archive.
1
Duplicity with http://superuser.com/questions/216617/zip-linux-view-files-in-archive
– pevik – 2014-07-03T12:37:27.690@fixer1234 (and others): The linked question asks, “How can I view the files in a ZIP archive?” AFAIC, that’s the same question as “How can I see the contents of a file …?” It’s unfortunate that many of the people who answered that question interpreted it as “How can I view the directory of the archive?” However, Gilles’s answer (naturally) and Rajasekhar Tolety’s answer (apparently) to that question provide answers to this question.
– Scott – 2017-04-21T19:42:09.5331@Scott, maybe we should figure out how to merge the two questions so both topics are covered in one, or refocus the other to clearly be about the directory and then move answers between both places to match the questions. Right now, both are a mishmash. – fixer1234 – 2017-04-21T20:12:58.357
@fixer1234: I agree, up to a point. The moderators are always telling us that duplicates are a good thing, because they provide a greater surface of exposure to the search engines (i.e., more chances that a search will find one of the questions). But there’s the rub: if a user finds one of the questions, and the linkage isn’t obvious (and nobody looks at the lists of “Linked” and “Related” questions — at least not random followers of search results), then the user has found only a fraction of the answers. DavidPostill cast the final vote to reopen this question; maybe you should talk to him. – Scott – 2017-04-21T20:26:13.887
@Scott — Given that the question asker marked the “How can I view the directory of the archive?” answer as accepted, I have to think that was likely the intent of the question. It is, unfortunately, ambiguously phrased such that it could mean either interpretation. – M. Justin – 2017-04-21T20:38:50.793
@M.Justin: I’m not sure whether that’s really relevant. If there are answers in that other thread that answer this question, then this question can/should be closed as a duplicate of that one. See the boilerplate text (you’ll have to find another question that’s closed as a duplicate, since this one has been reopened): “This question already has an answer here:” – Scott – 2017-04-21T20:57:35.950
@Scott — That all said, there's currently a meta question open discussing this pair of issues, in case you were unaware: https://meta.superuser.com/questions/12356/are-these-two-questions-about-viewing-zip-file-contents-actually-duplicates
– M. Justin – 2017-04-21T21:00:33.003'zcat' or 'zless' do this for gzipped files. They might also work with zips – Brad – 2017-05-01T11:56:46.643