Tuesday, January 8, 2008

Gnuzip

The gzip sources, written in C, are available here in various formats:
  • tar
  • shar
  • zip
  • tar.gz
  • tar.Z
If a file ends in .zip (for example, file.zip) type:
unzip file.zip

If a file ends in .tar (e.g., file.tar) type:
tar -xvf file.tar

tar -zxvpf my_tar_file.tar.gz

I've used my preferred options. I'll explain them:
-z - unzip the file first
-x - extract the files from the tarball
-v - "verbose" (i.e tar tells you what files it's extracting)
-p - preserves dates, permissions of the original files
-f - use the file in question (if you don't specify this, tar just sort of sits around doing nothing)
The files are extracted and your original tarball is preserved (my_tar_file.tar.gz).

If a file ends in .gz (for example, file.gz) type:
gzip -d file.gz

If a file ends in .tar.gz (e.g. file.tar.gz) type:
gzip -d file.tar.gz
and then
tar -xvf file.tar

If a file ends in .tgz (e.g. file.tgz) type:
tar -xvzf file.tgz

If file ends in tar.bz2(file.tar.bz2)type:
bzip2 -d file.bz2

No comments: