Filesystems – Integrate Zip and Tar.gz Files as Directories

filesfilesystemsmounttarzip

I wonder if there is a way to integrate (it's a bit different from mounting, I think) compressed files as directories into the file system?

E.g., one could download a compressed-file.tar.gz to his local hard drive, then do cd compressed-file.tar.gz and run a script from within the compressed folder or do cp some-file .. to extract one of the files.

I know that Btrfs supports compression, but I don't want to change the file system that I have (ext3) to support this feature.

Best Answer

You can use the command archivemount to mount archives such as .tar.gz.

$ ls
files.tgz    mnt/

$ archivemount files.tgz mnt

$ ls mnt
file1    file2

[... Perform desired read/write operations on the archive via mnt/ ...]

$ umount mnt

[... Any changes are saved to the archive ...]

See the man page for archivemount for more info. It's often times not installed so you'll likely need to install the package. It's also called archivemount. On Fedora 19, for example:

$ sudo yum install archivemount

References

Related Question