96
Chapter 9
The files have been extracted into the current directory; you can do
a long listing on the directory to double-check. Note that by default, if an
extracted file already exists,
tar
will remove the existing file and replace it
with the extracted file.
Compressing Files
Now we have one archived file, but that file is bigger than the sum of the
original files. What if you want to compress those files for ease of transport?
Linux has several commands capable of creating compressed files. We will
look at these:
•
gzip
, which uses the extension
.tar.gz or
.tgz
•
bzip2
, which uses the extension
.tar.bz2
•
compress
, which uses the extension
.tar.z
These all are capable of compressing our files, but they use different
compression algorithms and have different compression ratios. Therefore,
we’ll look at each one and what it’s capable of.
In general,
compress
is the fastest, but the resultant files are larger;
bzip2
is the slowest, but the resultant files are the smallest; and
gzip
falls some-
where in between. The main reason you, as a budding hacker, should know
all three methods is that when accessing other tools, you will run into vari-
ous types of compression. Therefore, this section shows you how to deal
with the main methods of compression.