I have a file, bigfile.tar which is 800MB uncompressed, and 500MB when compressed (bigfile.tar.gz). Now, none of my partitions has more than 300MB free. I need to read just a part of this archive, perhaps just a few files or a directory. Can I do that or do I have to buy a new hard disk?
Better keep your money for something else.
First, let me point out that, given the above situation, Midnight Commander will not be able to read into the file, when you press Enter on bigfile.tar.gz, because it still needs space to store temporary files (probably the same amount of space needed when decompressing and de-tarring the file). Midnight Commander will just fill up the /tmp directory on the root partition and will finally fail with a 'disc full' message :-( So this does not solve the problem. Even worse, after trying and not succeeding, remember to go to /tmp and erase the big files that Midnight created and could no longer erase, because it ended in error.
Luckily, there is a smart and relatively simple solution to this.
First, if you don't have it already, generate a list of the files in the archive:
gzip -c -d /mnt/cdrom/bigfile.tar.gz | tar -tv > bigfile.list
gzip -c -d /mnt/cdrom/bigfile.tar.gz | tar -xv fdonea/PROG
Return to : Unix System Administration Hints and Tips