Blame SOURCES/cpio.1

808377
.\" DO NOT MODIFY THIS FILE!  It was (partly) generated by help2man from
808377
.\" cpio --help/cpio --version output and partly patched by downstream
808377
.\" package maintainers.
808377
.TH CPIO 1L \" -*- nroff -*-
808377
.SH NAME
808377
cpio \- copy files to and from archives
808377
.SH __WARNING__
808377
.PP
808377
The cpio utility is considered LEGACY based on POSIX specification.  Users are
808377
encouraged to use other archiving tools for archive creation.
808377
808377
If you decided to use cpio, you should almost always force cpio to use the
808377
ustar format in copy-out mode by the -H option (cpio -o -H ustar).  This is
808377
because the ustar format is well defined in POSIX specification and thus
808377
readable by wide range of other archiving tools (including tar e.g.).
808377
808377
By default, GNU cpio uses (for historical reasons) the very old binary format
808377
('bin') which has significant problems nowadays, e.g. with storing big inode
808377
numbers (see the Red Hat bug #952313).
808377
808377
Note also that these days the modern 'pax' archive format should be considered
808377
as the default -- but this format is not implemented in GNU cpio.  You should,
808377
again, consider using other archivers (e.g. 'tar --format=pax').
808377
808377
.SH SYNOPSIS
808377
\&\fBCopy-out mode\fR
808377
.PP
808377
In copy-out mode, cpio copies files into an archive.  It reads a list
808377
of filenames, one per line, on the standard input, and writes the
808377
archive onto the standard output.  A typical way to generate the list
808377
of filenames is with the find command; you should give find the \-depth
808377
option to minimize problems with permissions on directories that are
808377
unreadable.  see \*(lqOptions\*(rq.
808377
.PP
808377
.B cpio
808377
{\-o|\-\-create} [\-0acvABLV] [\-C bytes] [\-H format] [\-D DIR]
808377
[\-M message] [\-O [[user@]host:]archive] [\-F [[user@]host:]archive]
808377
[\-\-file=[[user@]host:]archive] [\-\-format=format] [\-\-warning=FLAG]
808377
[\-\-message=message][\-\-null] [\-\-reset\-access\-time] [\-\-verbose]
808377
[\-\-dot] [\-\-append] [\-\-block\-size=blocks] [\-\-dereference]
808377
[\-\-io\-size=bytes] [\-\-rsh\-command=command]  [\-\-license] [\-\-usage]
808377
[\-\-help] [\-\-version]
808377
< name-list [> archive]
808377
.PP
808377
\&\fBCopy-in mode\fR
808377
.PP
808377
In copy-in mode, cpio copies files out of an archive or lists the
808377
archive contents.  It reads the archive from the standard input.  Any
808377
non-option command line arguments are shell globbing patterns; only
808377
files in the archive whose names match one or more of those patterns are
808377
copied from the archive.  Unlike in the shell, an initial `\fB.\fR' in a
808377
filename does match a wildcard at the start of a pattern, and a `\fB/\fR' in a
808377
filename can match wildcards.  If no patterns are given, all files are
808377
extracted.  see \*(lqOptions\*(rq.
808377
.PP
808377
.B cpio
808377
{\-i|\-\-extract} [\-bcdfmnrtsuvBSV] [\-C bytes] [\-E file] [\-H format]
808377
[\-D DIR]
808377
[\-M message] [\-R [user][:.][group]] [\-I [[user@]host:]archive]
808377
[\-F [[user@]host:]archive] [\-\-file=[[user@]host:]archive]
808377
[\-\-make-directories] [\-\-nonmatching] [\-\-preserve-modification-time]
808377
[\-\-numeric-uid-gid] [\-\-rename] [\-t|\-\-list] [\-\-swap-bytes] [\-\-swap]
808377
[\-\-dot] [\-\-warning=FLAG] [\-\-unconditional] [\-\-verbose]
808377
[\-\-block-size=blocks] [\-\-swap-halfwords] [\-\-io-size=bytes]
808377
[\-\-pattern-file=file] [\-\-format=format] [\-\-owner=[user][:.][group]]
808377
[\-\-no-preserve-owner] [\-\-message=message]
808377
[\-\-force\-local] [\-\-no\-absolute\-filenames] [\-\-absolute\-filenames]
808377
[\-\-sparse] [\-\-only\-verify\-crc] [\-\-to\-stdout] [\-\-quiet]
808377
[\-\-ignore\-devno] [\-\-renumber\-inodes] [\-\-device\-independent]
808377
[\-\-reproducible]
808377
[\-\-rsh-command=command] [\-\-license] [\-\-usage] [\-\-help]
808377
[\-\-version] [pattern...] [< archive]
808377
.PP
808377
\&\fBCopy-pass mode\fR
808377
.PP
808377
In copy-pass mode, cpio copies files from one directory tree to
808377
another, combining the copy-out and copy-in steps without actually
808377
using an archive.  It reads the list of files to copy from the standard
808377
input; the directory into which it will copy them is given as a
808377
non-option argument.  see \*(lqOptions\*(rq.
808377
.PP
808377
.B cpio
808377
{\-p|\-\-pass-through} [\-0adlmuvLV] [\-R [user][:.][group]] [\-D DIR]
808377
[\-\-null] [\-\-reset-access-time] [\-\-make-directories] [\-\-link] [\-\-quiet]
808377
[\-\-preserve-modification-time] [\-\-unconditional] [\-\-verbose] [\-\-dot]
808377
[\-\-warning=FLAG] [\-\-dereference] [\-\-owner=[user][:.][group]]
808377
[\-\-no-preserve-owner] [\-\-sparse]  [\-\-license] [\-\-usage] [\-\-help]
808377
[\-\-version] destination-directory < name-list
808377
.PP
808377
.SH DESCRIPTION
808377
GNU cpio is a tool for creating and extracting archives, or copying
808377
files from one place to another.  It handles a number of cpio formats as
808377
well as reading and writing tar files.
808377
.PP
808377
Following archive formats are supported: binary, old ASCII, new ASCII, crc, HPUX binary, HPUX old
808377
ASCII, old tar, and POSIX.1 tar.  The tar format is provided for compatibility with the tar program. By
808377
default, cpio creates binary format archives, for compatibility with older cpio programs.  When extracting
808377
from archives, cpio automatically recognizes which kind of archive it is reading and can read archives created 
808377
on machines with a different byte-order.
808377
.PP
808377
.SS "Main operation mode:"
808377
.TP
808377
\fB\-i\fR, \fB\-\-extract\fR
808377
Extract files from an archive (run in copy\-in
808377
mode)
808377
.TP
808377
\fB\-o\fR, \fB\-\-create\fR
808377
Create the archive (run in copy\-out mode)
808377
.TP
808377
\fB\-p\fR, \fB\-\-pass\-through\fR
808377
Run in copy\-pass mode
808377
.TP
808377
\fB\-t\fR, \fB\-\-list\fR
808377
Print a table of contents of the input
808377
.SS "Operation modifiers valid in any mode:"
808377
.TP
808377
\fB\-\-block\-size\fR=\fI\,BLOCK\-SIZE\/\fR
808377
Set the I/O block size to BLOCK\-SIZE * 512
808377
bytes
808377
.TP
808377
\fB\-B\fR
808377
Set the I/O block size to 5120 bytes.
808377
Initially the block size is 512 bytes.
808377
.TP
808377
\fB\-c\fR
808377
Identical to "\-H newc", use the new (SVR4)
808377
portable format. If you wish the old portable
808377
(ASCII) archive format, use "\-H odc" instead.
808377
.TP
808377
\fB\-C\fR, \fB\-\-io\-size\fR=\fI\,NUMBER\/\fR
808377
Set the I/O block size to the given NUMBER of
808377
bytes
808377
.TP
808377
\fB\-D\fR, \fB\-\-directory\fR=\fI\,DIR\/\fR
808377
Change to directory DIR
808377
.TP
808377
\fB\-\-force\-local\fR
808377
With \-F, \-I, or \-O, take the archive file name to be a local file
808377
even if it contains a colon, which would ordinarily indicate a
808377
remote host name.
808377
.TP
808377
\fB\-H\fR, \fB\-\-format\fR=\fI\,FORMAT\/\fR
808377
Use given archive FORMAT.
808377
The valid formats are listed below; the same names are also recognized in
808377
all\-caps.  The default in copy-in mode is to automatically detect the archive
808377
format, and in copy-out mode is `\fBbin\fR'.
808377
.TP
808377
`bin'
808377
The obsolete binary format.
808377
.TP
808377
`odc'
808377
The old (\s-1POSIX\s0.1) portable format.
808377
.TP
808377
`newc'
808377
The new (\s-1SVR4\s0) portable format, which supports file systems
808377
having more than 65536 i\-nodes.
808377
.TP
808377
`crc'
808377
The new (\s-1SVR4\s0) portable format with a checksum (Sum32) added.
808377
.TP
808377
`tar'
808377
The old tar format.
808377
.TP
808377
`ustar'
808377
The \s-1POSIX\s0.1 tar format.  Also recognizes \s-1GNU\s0 tar archives,
808377
which are similar but not identical.
808377
.TP
808377
`hpbin'
808377
The obsolete binary format used by \s-1HPUX\s0's cpio (which stores
808377
device files differently).
808377
.TP
808377
`hpodc'
808377
The portable format used by \s-1HPUX\s0's cpio (which stores device
808377
files differently).
808377
.TP
808377
\fB\-\-quiet\fR
808377
Do not print the number of blocks copied
808377
.TP
808377
\fB\-R\fR, \fB\-\-owner\fR=\fI\,[USER][\/\fR:.][GROUP]
808377
Set the ownership of all files created to the
808377
specified USER and/or GROUP.
808377
Either the user, the group, or both, must be present.  If the group is omitted
808377
but the \&\*(lq:\*(rq or \*(lq.\*(rq separator is given, use the given user's
808377
login group.  Only the super-user can change files' ownership in copy\-in mode.
808377
.TP
808377
\fB\-v\fR, \fB\-\-verbose\fR
808377
List the files processed, or with `\fB\-t\fR', give an `\fBls \-l\fR' style
808377
table of contents listing.  In a verbose table of contents of a
808377
ustar archive, user and group names in the archive that do not
808377
exist on the local system are replaced by the names that
808377
correspond locally to the numeric \s-1UID\s0 and \s-1GID\s0 stored in the
808377
archive.
808377
.TP
808377
\fB\-V\fR, \fB\-\-dot\fR
808377
Print a "." for each file processed
808377
.TP
808377
\fB\-W\fR, \fB\-\-warning\fR=\fI\,FLAG\/\fR
808377
Control warning display. Currently FLAG is one of
808377
\&'none', 'truncate', 'all'. Multiple options
808377
accumulate.
808377
.SS "Operation modifiers valid in copy-in and copy-out modes:"
808377
.TP
808377
\fB\-F\fR, \fB\-\-file\fR=\fI\,[[USER\/\fR@]HOST:]FILE\-NAME
808377
Use this FILE\-NAME instead of standard input or
808377
output. Optional USER and HOST specify the user
808377
and host names in case of a remote archive
808377
.TP
808377
\fB\-M\fR, \fB\-\-message\fR=\fI\,STRING\/\fR
808377
Print \s-1STRING\s0 when the end of a volume of the backup media (such
808377
as a tape or a floppy disk) is reached, to prompt the user to
808377
insert a new volume.  If \s-1STRING\s0 contains the string \*(lq%d\*(rq, it is
808377
replaced by the current volume number (starting at 1).
808377
.TP
808377
\fB\-\-rsh\-command\fR=\fI\,COMMAND\/\fR
808377
Use COMMAND instead of rsh
808377
(typically /usr/bin/ssh)
808377
.SS "Operation modifiers valid only in copy-in mode:"
808377
.TP
808377
\fB\-b\fR, \fB\-\-swap\fR
808377
Swap both halfwords of words and bytes of
808377
halfwords in the data. Equivalent to \fB\-sS\fR
808377
Use this option to convert 32\-bit integers between big-endian and little-endian
808377
machines.
808377
.TP
808377
\fB\-f\fR, \fB\-\-nonmatching\fR
808377
Only copy files that do not match any of the given
808377
patterns
808377
.TP
808377
\fB\-I\fR [[USER@]HOST:]FILE\-NAME
808377
Archive filename to use instead of standard input.
808377
Optional USER and HOST specify the user and host
808377
names in case of a remote archive
808377
.TP
808377
\fB\-n\fR, \fB\-\-numeric\-uid\-gid\fR
808377
In the verbose table of contents listing, show
808377
numeric UID and GID
808377
.TP
808377
\fB\-r\fR, \fB\-\-rename\fR
808377
Interactively rename files
808377
.TP
808377
\fB\-s\fR, \fB\-\-swap\-bytes\fR
808377
Swap the bytes of each halfword in the files
808377
.TP
808377
\fB\-S\fR, \fB\-\-swap\-halfwords\fR
808377
Swap the halfwords of each word (4 bytes) in the
808377
files
808377
.TP
808377
\fB\-\-to\-stdout\fR
808377
Extract files to standard output
808377
.TP
808377
\fB\-E\fR, \fB\-\-pattern\-file\fR=\fI\,FILE\/\fR
808377
Read additional patterns specifying filenames to
808377
extract or list from FILE
808377
.TP
808377
\fB\-\-only\-verify\-crc\fR
808377
When reading a CRC format archive, only verify the
808377
checksum of each file in the archive, don't
808377
actually extract the files
808377
.SS "Operation modifiers valid only in copy-out mode:"
808377
.TP
808377
\fB\-A\fR, \fB\-\-append\fR
808377
Append to an existing archive.
808377
The archive must be a disk file specified with the \-O or \-F (\-file) option.
808377
.TP
808377
\fB\-\-device\-independent\fR, \fB\-\-reproducible\fR
808377
Create device\-independent (reproducible) archives
808377
.TP
808377
\fB\-\-ignore\-devno\fR
808377
Don't store device numbers
808377
.TP
808377
\fB\-O\fR [[USER@]HOST:]FILE\-NAME
808377
Archive filename to use instead of standard
808377
output. Optional USER and HOST specify the user
808377
and host names in case of a remote archive
808377
.TP
808377
\fB\-\-renumber\-inodes\fR
808377
Renumber inodes
808377
.SS "Operation modifiers valid only in copy-pass mode:"
808377
.TP
808377
\fB\-l\fR, \fB\-\-link\fR
808377
Link files instead of copying them, when
808377
possible
808377
.SS "Operation modifiers valid in copy-in and copy-out modes:"
808377
.TP
808377
\fB\-\-absolute\-filenames\fR
808377
Do not strip file system prefix components from
808377
the file names
808377
.TP
808377
\fB\-\-no\-absolute\-filenames\fR
808377
Create all files relative to the current
808377
directory
808377
.SS "Operation modifiers valid in copy-out and copy-pass modes:"
808377
.TP
808377
\fB\-0\fR, \fB\-\-null\fR
808377
Filenames in the list are delimited by null
808377
characters instead of newlines, so that files whose names contain newlines can
808377
be archived.  \s-1GNU\s0 find is one way to produce a list of null-terminated
808377
filenames.
808377
.TP
808377
\fB\-a\fR, \fB\-\-reset\-access\-time\fR
808377
Reset the access times of files after reading them, so that it
808377
does not look like they have just been read.
808377
.TP
808377
\fB\-L\fR, \fB\-\-dereference\fR
808377
Dereference  symbolic  links  (copy  the files
808377
that they point to instead of copying the links).
808377
.SS "Operation modifiers valid in copy-in and copy-pass modes:"
808377
.TP
808377
\fB\-d\fR, \fB\-\-make\-directories\fR
808377
Create leading directories where needed
808377
.TP
808377
\fB\-m\fR, \fB\-\-preserve\-modification\-time\fR
808377
Retain previous file modification times when
808377
creating files
808377
.TP
808377
\fB\-\-no\-preserve\-owner\fR
808377
Do not change the ownership of the files; leave them owned by the
808377
user extracting them.  This is the default for non-root users, so
808377
that users on System V don't inadvertently give away files.  This
808377
option can be used in copy-in mode and copy-pass mode
808377
.TP
808377
\fB\-\-sparse\fR
808377
Write files with large blocks of zeros as sparse
808377
files
808377
.TP
808377
\fB\-u\fR, \fB\-\-unconditional\fR
808377
Replace all files unconditionally
808377
.TP
808377
\-?, \fB\-\-help\fR
808377
give this help list
808377
.TP
808377
\fB\-\-usage\fR
808377
give a short usage message
808377
.TP
808377
\fB\-\-version\fR
808377
print program version
808377
.PP
808377
Mandatory or optional arguments to long options are also mandatory or optional
808377
for any corresponding short options.
808377
808377
.PP
808377
.SH EXAMPLES
808377
When creating an archive, cpio takes the list of files to be
808377
processed from the standard input, and then sends the archive to the
808377
standard output, or to the device defined by the `\fB\-F\fR' option.
808377
Usually find or ls is used to provide this list to
808377
the standard input.  In the following example you can see the
808377
possibilities for archiving the contents of a single directory.
808377
.PP
808377
.B % ls | cpio \-ov > directory.cpio
808377
.PP
808377
The `\fB\-o\fR' option creates the archive, and the `\fB\-v\fR' option prints the
808377
names of the files archived as they are added.  Notice that the options
808377
can be put together after a single `\fB\-\fR' or can be placed separately on
808377
the command line.  The `\fB>\fR' redirects the cpio output to the file
808377
`\fBdirectory.cpio\fR'.
808377
.PP
808377
If you wanted to archive an entire directory tree, the find command
808377
can provide the file list to cpio:
808377
.PP
808377
.B % find . \-print \-depth | cpio \-ov > tree.cpio
808377
.PP
808377
This will take all the files in the current directory, the
808377
directories below and place them in the archive tree.cpio.  Again the
808377
`\fB\-o\fR' creates an archive, and the `\fB\-v\fR' option shows you the name of the
808377
files as they are archived.  see \*(lqCopy\-out mode\*(rq.  Using the `\fB.\fR' in
808377
the find statement will give you more flexibility when doing restores,
808377
as it will save file names with a relative path vice a hard wired,
808377
absolute path.  The `\fB\-depth\fR' option forces `\fBfind\fR' to print of the
808377
entries in a directory before printing the directory itself.  This
808377
limits the effects of restrictive directory permissions by printing the
808377
directory entries in a directory before the directory name itself.
808377
.PP
808377
Extracting an archive requires a bit more thought because cpio will
808377
not create directories by default.  Another characteristic, is it will
808377
not overwrite existing files unless you tell it to.
808377
.PP
808377
.B % cpio \-iv < directory.cpio
808377
.PP
808377
This will retrieve the files archived in the file directory.cpio and
808377
place them in the present directory.  The `\fB\-i\fR' option extracts the
808377
archive and the `\fB\-v\fR' shows the file names as they are extracted.  If
808377
you are dealing with an archived directory tree, you need to use the
808377
`\fB\-d\fR' option to create directories as necessary, something like:
808377
.PP
808377
.B % cpio \-idv < tree.cpio
808377
.PP
808377
This will take the contents of the archive tree.cpio and extract it
808377
to the current directory.  If you try to extract the files on top of
808377
files of the same name that already exist (and have the same or later
808377
modification time) cpio will not extract the file unless told to do so
808377
by the \-u option.  see \*(lqCopy\-in mode\*(rq.
808377
.PP
808377
In copy-pass mode, cpio copies files from one directory tree to
808377
another, combining the copy-out and copy-in steps without actually
808377
using an archive.  It reads the list of files to copy from the standard
808377
input; the directory into which it will copy them is given as a
808377
non-option argument.  see \*(lqCopy\-pass mode\*(rq.
808377
.PP
808377
.B % find . \-depth \-print0 | cpio \-\-null \-pvd new-dir
808377
.PP
808377
The example shows copying the files of the present directory, and
808377
sub-directories to a new directory called new\-dir.  Some new options are
808377
the `\fB\-print0\fR' available with \s-1GNU\s0 find, combined with the `\fB\-\-null\fR'
808377
option of cpio.  These two options act together to send file names
808377
between find and cpio, even if special characters are embedded in the
808377
file names.  Another is `\fB\-p\fR', which tells cpio to pass the files it
808377
finds to the directory `\fBnew-dir\fR'.
808377
808377
808377
.SH AUTHOR
808377
Written by Phil Nelson, David MacKenzie, John Oleynick,
808377
and Sergey Poznyakoff.
808377
.SH "REPORTING BUGS"
808377
Report bugs to <bug\-cpio@gnu.org>.
808377
Report bugs in this manual page via https://bugzilla.redhat.com.
808377
.SH COPYRIGHT
808377
Copyright \(co 2015 Free Software Foundation, Inc.
808377
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
808377
.br
808377
This is free software: you are free to change and redistribute it.
808377
There is NO WARRANTY, to the extent permitted by law.
808377
.SH "SEE ALSO"
808377
The full documentation for
808377
.B cpio
808377
is maintained as a Texinfo manual.  If the
808377
.B info
808377
and
808377
.B cpio
808377
programs are properly installed at your site, the command
808377
.IP
808377
.B info cpio
808377
.PP
808377
should give you access to the complete manual.
808377
808377
The online copy of the documentation is available at the following address:
808377
.PP
808377
http://www.gnu.org/software/cpio/manual