Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am wondering if I can refer to files inside JAR or ZIP files using URLs. I mean, without using a tool (such as the Java Jar utility) but just at the operative system level.

For example, if I have a file myfile in a Jar file myjar, I would like to be able to write something like:

ls -name 'jar:file:/myjar!/myfile'

and see listed the file myfile

The context of this question is that I need to load Prolog files that are zipped in JARs files, but currently I have not discovered how to do this with the console based Prolog interpreter I am using (YAP). In the hope that at the end the command for loading Prolog files will just submit the request to the operative system, I thought that I just need to find out the right way to refer to files inside JAR or ZIP files in such a way that the operative system understands what I am talking about (I am using OSX).

share|improve this question
What this person did looks interesting .... is it standard? developer.gooddata.com/cloudconnect/manual/… – user86037 Sep 29 '14 at 15:54

The AVFS filesystem presents a view of the filesystem where every archive file /path/to/foo.zip is accessible as a directory ~/.avfs/path/to/foo/zip#. AVFS provides read-only access to most common archive file formats.

Install AVFS (it's provided by many distributions; it requires FUSE, which every modern unix supports). Run this command once and for all (you can run it from your ~/.profile):


And thereafter:

ls /path/to/my.jar\#/myfile
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.