HOME


SMALL NOTE ON TAR AND GZIP/GUNZIP

By Mikkel Meinike Nielsen
Contact

Again one thing that it has taken me a long time to dig. 'Tar' and 'gzip/gunzip' are different processes. 'Tar' dos not reduce file size it only bundles files while keeping track on directories and file names.

tar cv -f my.tar file1 file2

creates the file 'my.tar' containing file1 and file2

Now in order to pack the file in a way that reduce the file size you use 'gzip'

gzip my.tar

'gzip' overwrite the input file so 'my.tar' will be substituted with 'my.tar.gz' which is a size-reduced file.

Unpacking is the same just the other way around.

gunzip my.tar.gz

Substitute 'my.tar.gz' with 'my.tar' which is not a size-reduced file. And then

tar xvf my.tar

Un-buntles the file.

This is not the normal way to treat a 'tar.gz' archive. Most version of 'tar' can handle both the 'tar' and the 'gzip/gunzip' process in just one go if given the right options for it, but some versions of 'tar' can't, like the 'buiseybox tar' in
Basiclinux 3. So it is nice to know that basically it is a two step action and that you can still do it this way.


/Mikkel


site map