dslreports logo
site
spacer

spacer
 
    «« DSL Hurdles Share Tool
spc

spacer




how-to block ads



These are the windows equivalent of .zip or .rar files. Many files that you download for programs will end in .tar.gz (others will end in .tgz, .tar.bz2, some files will end even in just .gz or just .bz2!). The same way you can put multiple files into 1 zip file you do this in linux by making a .tar file. However this doesn't compress it like a .zip does. So then you add either the more popular .gz or the less used .bz2. Of the two .bz2 seems to have better compression than .gz.

To remove the gz from a file do:
gzip -d filename.tar.gz
gzip -d filename.gz

than to remove the tar:
tar -xvf filename.tar

to remove .bz2
bunzip2 filename.tar.bz2
bunzip2 filename.bz2

In recent versions of GNU tar you can also both decompress the file and expand the archive in one operation. The '-z' option decompresses gzip files (.gz) and '-j' decompresses bzip2 (.bz2) files. Try the following:

tar -zxvf filename.tar.gz
tar -zxvf filename.tgz
tar -jxvf filename.tar.bz2

Note that in many of these examples we are combining the command-line switches (the -z and such after the command). In the last example, we could have written the following and achieved the same effect:

tar -z -x -v -f filename.tar.gz

We like to combine switches purely for our own convenience. The '-z' we've already covered. The '-x' tells tar to expand the archive out into its individual files. The '-v' is for verbose, where it will print the name of each file it expands to the screen. The '-f' is the force option, where we simply tell it to automatically confirm each file; otherwise, we would have to confirm every file as it gets written to disk.

Feedback received on this FAQ entry:
  • the info was helpful and easy to implement

    2009-04-06 05:21:20



Expand got feedback?

by Techie2000 See Profile edited by yock See Profile
last modified: 2006-10-23 10:37:26