16-01-2013, 10:10 AM
UNIX Utilities for Power Users
1UNIX.pdf (Size: 2.21 MB / Downloads: 58)
MOTIVATION
In addition to the common file-oriented UNIX utilities, there are plenty of other
utilities that process text, schedule commands, archive files, and sort files. This chap
ter contains descriptions and examples of the utilities that will be most useful in in
creasing your productivity.
INTRODUCTION
The utilities we will be discussing may be logically grouped into sets as shown in
Figure 3.1. We will examine each group in turn, describing its members and illustrating
their operational worked-out examples. Note that, while most of these utilities exist in
all versions of UNIX, this is not true for every version.
File Differences: diff
The duff utility compares two files and displays a list of editing changes that would con
vert the first file into the second file. It works as shown in Figure 3.9. There are three
kinds of editing changes: adding lines (a), changing lines ©, and deleting lines (d).
Figure 3.10 shows the format that duff uses to describe each kind of edit.
Tape Archiving: tar
The tar utility was designed specifically for maintaining an archive of files on a mag
netic tape. When you add a file to an archive file using tar, the file is always placed at
the end of the archive file, since you cannot modify the middle of a file that is stored on
tape. If you’re not archiving files to a tape, I suggest that you use the cpio utility in
stead. Figure 3.14 shows how tar works.
Incremental Backups: dump and restore
The dump and restore commands came from the Berkeley version of UNIX, but have
been added to most other versions. (In many System V-based versions of UNIX, they
are ufsdump and ufsrestore.) Here’s a system administrator’s typical backup strategy:
• Perform a weekly total-file system backup.
• Perform a daily incremental backup, storing only those files that were changed
since the last incremental backup