Tar, untar, gzip and finding out a file type
From Linux Solutions
Zipping Files with tar
putting all under directory into the /tmp/archive.tar-file. It will not be compressed therefore it is faster than with compression:
tar cvf /tmp/archive.tar directory
compressing all under directory into the /tmp/archive.tar.gz-file. It will be compressed but takes longer:
tar cvzf /tmp/archive.tar.gz directory
(directory could by a list of files and directory which you want to be tared)
Unpacking or unzipping a file:
unpacking /tmp/archive.tar into the actual directory:
tar xvf /tmp/archive.tar
unzipping /tmp/archive.tar.gz into the actual directory:
tar xvzf /tmp/archive.tar.gz
unzipping /tmp/archive.tar.bz2 into the actual directory:
tar xvjf /tmp/archive.tar.bz2
The option "v" tells tar that it should print the names of all files which are compressed or decompressed. If your Internet connection is slow, it will slow the progress significantly down. So may you leave out "v".
If you have an file and you are not sure, what type it is, try this:
file filename
e.g.
file /tmp/archive.tar.bz2
gives you
/tmp/archive.tar.bz2: bzip2 compressed data, block size = 900k
you can decompress it with
bunzip2 /tmp/archive.tar.bz2
you get /tmp/archive.tar
file /tmp/archive.tar
gives you
/tmp/archive.tar: POSIX tar archive
and you can extract it with
tar xvf /tmp/archive.tar
Andreas B.M. Hofmeier.