Tillmann Steinbrecher made a wonderful command-line tool for extracting .tar.gz, .tar, and some .zip files. It is called untgz and version 0.95 is the most recent, with that one being released February 17, 1997. One very great thing he did was to release the source code with the tool and put everything under the GPL, version 2.
I was looking for a tiny tool that I would put on my boot disk to extract an archive to a ramdisk so I could install more tools than the single floppy would allow. The method is similar to Bart's Modular Boot Disk. Originally, I used .zip archives because I found a 50k unzip program. Then I switched to .rar because I located a 26k unrar program. I upgraded my Linux machine and found out that the newer version of rar can't be decompressed with my unrar file, so I searched the web again for a standard format that I could create on Linux and decompress on DOS. I was very fortunate and found untgz.
Since I had the source at my disposal, I felt an overwhelming urge to see how much extra I could strip from this 57k program, especially since I would be using this as a decompression tool only on my boot floppy, where space is at a premium. So, with a "just extract the file" type of mindset, I made the following changes to reduce the size of the program:
In the end, I had a 9k untgz program that only used the 8.3 DOS filename standard, and a 15k executable that supported 32-bit and long filenames. I would say that's a significant savings! 1/6 the size for the little one, 1/4 the size for the 32-bit version.
I certainly don't think that this is a useful all-around tool anymore. However, if you have a specific need for an extremely small program that can extract .tar.gz files, this will work wonders for you! If the program reports an error while decompressing, use the larger version for a more detailed description of what's going on at that moment.
Use the original version first! If you have any errors with your .tgz file, you will see more detailed explanations of problems there. If you have no problems, you can then move on to the stripped version.
To achieve maximum compression and remove the "original filename" from the gzip header, you should use pipes. Pass the data directly to gzip from tar like this:
tar cvf - data_directory/ | gzip -9 > output.tgz
Using "tar cvfz" instead will use the default compression level (6) and will include more data in the gzip header. We're only talking about a few bytes here, but that can be enough when you are dealing with a tiny boot disk.