344
Networking: A Beginner's Guide
For example, to find all files in /tmp that have not been accessed in at least seven
days, type the following:
[root@ford /root]# find /tmp -atime 7 -print
To find all files in /usr/src whose names are core and then remove them, type the
following:
[root@ford /root]# find /usr/src -name core -exec rm {} \;
To find all files in /home with the extension .jpg that are bigger than 100KB, type
the following:
[root@ford /root]# find /home -name "*.jpg" -size 100k
dd: Convert and Copy a File
The dd command reads the contents of a file and sends them to another file. What
makes dd different from cp is that dd can perform on-the-fly conversions on the file
and can accept data from a device (such as a tape or floppy drive). When dd accesses a
device, it does not assume anything about the file system and instead pulls the data in
a raw format. Thus, you can use the data to generate images of disks, even if the disk is
of foreign format. Table 21-6 lists the most common parameters for dd:
For example, to generate an image of a floppy disk (which is especially useful for
foreign file formats), type the following:
[root@ford /root]# dd if=/dev/fd0 of=/tmp/floppy_image
Option
Description
if=infile
Specify the input file as infile.
of=outfile
Specify the output file as outfile.
count=blocks
Specify blocks as the number of blocks on which dd should
operate before quitting.
ibs=size
Set the block size of the input device to be size.
obs=size
Set the block size of the output device to be size.
seek=blocks
Skip blocks number of blocks on the output.
skip=blocks
Skip blocks number of blocks on the input.
swab
Convert big endian input to little endian, or vice versa.
Table 21-6.
Common dd Command Options