tar is the most popular backup utility discussed in this chapter. Many of the files that you download from the Internet are in tar or compressed tar format. Although it usually isn’t used for daily backup and recovery, you are sure to find several uses for the tar utility .
As mentioned earlier, tar cannot preserve the access times of files that it backs up. If this is important to you, the GNU version of tar is able to do this.
The basic tar command is as follows:
Now let’s look at some example commands. To create an archive
of a directory called
pattern, use the command:
To do the same thing, but with a blocking factor of 20, use the command:
tar cvbf 20
To do the same thing, but to have tar verify the data as it writes it (available only in GNU tar), use the command:
gtar cvWbf 20
To create an archive of everything in the current directory starting with an “a”, use the command:
tar has two great advantages. The first is the level of acceptance that it has received. The second is its short list of options—there really are not very many:
The c option tells tar to create an archive (to make a backup).
The v option tells tar to be verbose. It lists the name and size of each file as it is being archived.
The W option, available only in GNU tar, tells tar to attempt ...