Compressing and Archiving
99
device, most often 4KB (4,096 bytes).
With these options, your command
would look like this:
kali >
dd if=/dev/media of=/root/flashcopy bs=4096 conv:noerror
As mentioned, it’s worth doing a little more research on your own, but
this is a good introduction to the command and its common usages.
Summary
Linux has a number of commands to enable
you to combine and compress
your files for easier transfer. For combining files,
tar
is the command of
choice, and you have at least three utilities for compressing files—
gzip
,
bzip2
,
and
compress
—all with different compression ratios. The
dd
command goes
above and beyond. It enables you to make a physical copy of storage devices
without the logical structures such as a filesystem,
allowing you to recover
such artifacts as deleted files.
E XERCISES
Before you move on to Chapter 10, try out the skills you learned from this
chapter by completing the following exercises:
1. Create three scripts to combine, similar to what we did in Chapter 8.
Name them
Linux4Hackers1
,
Linux4Hackers2
, and
Linux4Hackers3
.
2. Create a tarball from these three files. Name the tarball
L4H
.
Note how the
size of the sum of the three files changes when they are tarred together.
3. Compress the
L4H
tarball with
gzip
. Note how the size of the file changes.
Investigate how you can control overwriting existing files. Now uncompress
the
L4H
file.
4. Repeat Exercise 3 using both
bzip2
and
compress
.
5.
Make a physical, bit-by-bit copy of one of your flash drives using the
dd
command.