Information Technology Reference
In-Depth Information
Copy in (
-i
command-line argument)—Reads an archive to extract
the directories and files and recreates them at a specified location
on the system.
➤
Pass (
-p
command-line argument)—Reads a list of directories/files
(along with their contents) and reproduces them at a specified location
on the system.
➤
Table 8.5 lists the most commonly used
cpio
command-line arguments. See
the
cpio(1)
manual page for additional details.
Table 8.5
Selected cpio Command-Line Arguments
Argument
Description
-a
Resets file access times (used with
-i
)
-A
Appends to the archive (used with
-o
)
-d
Creates directories as needed (used with
-i
and
-p
)
-i
Copies in (extracts from archive)
-I
file
Reads contents of
file
as input archive (used with
-i
)
-L
Follows symbolic links (used with
-o
and
-p
)
-m
Retains modification times (used with
-i
and
-p
)
-o
Copies out (creates an archive)
-O
file
Uses
file
as an output archive (used with
-o
)
-p
Passes input to output
-t
Prints archive table of contents—no files are created (used with
-i
)
-u
Copies files unconditionally—older files will overwrite newer files (used
with
-i
and
-p
)
-v
Prints filenames in verbose mode
The following listing shows some typical uses of the
cpio
command. The
first
cpio
command uses the output of the
ls
command to generate a list of
files to place in the file
archive
. The second
cpio
command lists the contents
of
archive
. The third
cpio
command extracts files from
archive
.
# ls
file1 file2 file3 file4
# ls | cpio -ov -O archive
file1
file2
file3
file4
272 blocks