Information Technology Reference
In-Depth Information
Table 8.4
The tar Functions
Function
Description
c
Creates (overwrites) a tape archive
r
Replaces the named files in a tape archive
t
Lists the files in a tape archive
u
Updates the named files in a tape archive
x
Extracts all the named files from a tape archive
Along with these functions, the f tar_file command-line argument is used
to specify a backup device. If this command-line argument is not used, either
the backup device specified by the TAPE environmental variable or the
backup device identified in the /etc/default/tar file is used. The files or
directories to be backed up are listed as command-line arguments after the
function and argument. The v option can be used to display the names of
files as they are added to or extracted from the archive.
In some situations, using the tar command to create a single archive of
directories and files will result in an archive that uses less space than all the
original files and directories. Thus, the tar command can be used to reduce
storage space requirements.
Backing Up a Directory Using the tar Command
The following listing shows how the tar command is used to back up the
/export/home directory to the /dev/rmt/0 tape drive:
# tar cf /dev/rmt/0 /export/home
Restoring a Directory Using the tar Command
The following listing shows the tar command being used to restore the
/export/home directory from the /dev/rmt/0 tape drive:
# tar xf /dev/rmt/0
The cpio Command
The cpio(1) command can also be used to create an archive of directories
and files. The cpio command operates in three modes:
Copy out ( -o command-line argument)—Reads a list of directory and
filenames, and then copies their contents along with control information
to an archive format.
Search WWH ::




Custom Search