COHERENT manpages
This page displays the COHERENT manpage for gnucpio [Archiving/backup utility].
List of available manpages
Index
gnucpio -- Command
Archiving/backup utility
Copy-in mode: cpio {-o|--create} [-0acvABLV] [-C bytes] [-H format] [-M
message] [-O [[user@]host:]archive] [-F [[user@]host:]archive] [--
file=[[user@]host:]archive] [--format=format] [--message=message] [--null]
[--reset-access-time] [--verbose] [--dot] [--append] [--block-size=blocks]
[--dereference] [--io-size=bytes] [--version] < name-list [> archive]
Copy-out mode: cpio {-i|--extract} [-bcdfmnrtsuvBSV] [-C bytes] [-E file]
[-H format] [-M message] [-R [user][:.][group]] [-I [[user@]host:]archive]
[-F [[user@]host:]archive] [--file=[[user@]host:]archive] [--make-
directories] [--nonmatching] [--preserve-modification-time] [--numeric-uid-
gid] [--rename] [--list] [--swap-bytes] [--swap] [--dot] [--unconditional]
[--verbose] [--block-size=blocks] [--swap-halfwords] [--io-size=bytes] [--
pattern-file=file] [--format=format] [--owner=[user][:.][group]] [--no-
preserve-owner] [--message=message] [--version] [pattern...] [< archive]
Copy-through mode: cpio {-p|--pass-through} [-0adlmuvLV] [-R
[user][:.][group]] [--null] [--reset-access-time] [--make-directories] [--
link] [--preserve-modification-time] [--unconditional] [--verbose] [--dot]
[--dereference] [--owner=[user][:.][group]] [--no-preserve-owner] [--
version] destination-directory < name-list
gnucpio is the GNU version of the archive utility cpio. It copies files
into or out of a cpio or tar archive, which is a file that contains other
files plus information about them, such as their pathname, owner,
timestamps, and access permissions. The archive can be another file on the
disk, a magnetic tape, or a pipe.
gnucpio has three operating modes.
Copy-out Mode
gnucpio copies files into an archive. It reads a list of file names,
one per line, from the standard input, and writes the archive onto the
standard output.
Copy-in Mode
gnucpio copies files from an archive or lists the archive's contents.
It reads the archive from the standard input. Any non-option command-
line arguments are shell wild-card patterns; only files in the archive
whose names match one or more of those patterns are copied from the
archive. Unlike in the shell, an initial `.' in a file name does
match a wildcard at the start of a pattern, and a `/' in a file name
can match wildcards. If the command line contains no pattern, gnucpio
extracts all files.
Copy-pass Mode
gnucpio copies files from one directory tree to another. This
combines the copy-out and copy-in steps without actually using an
archive. It reads the list of files to copy from the standard input;
the directory into which it copies them is given as a non-option
argument.
gnucpio supports the following archive formats: binary, old ASCII, new
ASCII, crc, old tar, and POSIX.1 tar. The binary format is obsolete because
it encodes information about the files in a way that is not portable
between different machine architectures. The old ASCII format is portable
between different machine architectures, but should not be used on file
systems with more than 65536 i-nodes. The new ASCII format is portable
between different machine architectures and can be used on any size file
system, but is not supported by all versions of cpio; currently, it is only
supported by GNU and UNIX System V R4. The crc format resembles the new
ASCII format, but also contains a checksum for each file that gnucpio
calculates when creating an archive and verifies when the file is extracted
from the archive.
tar format is provided for compatability with the command tar. It can not
be used to archive a file whose name exceeds 100 characters, and cannot be
used to archive block or character devices. The POSIX.1 tar format can not
be used to archive a file whose name exceeds 255 characters (less unless it
has a `/' in just the right place).
By default, gnucpio creates binary archives, for compatibility with older
cpio programs. When extracting from archives, gnucpio automatically
recognizes the kind of archive it is reading, and can read archives created
on machines with a different byte-order.
Options
gnucpio recognizes the following command-line options. Not every option
applies to every mode. You can prefix the long-named options with an `+'
as well as with an `--', for compatibility with previous releases.
Eventually, support for `+' will be removed, because it is incompatible
with the POSIX Standard.
-0
--null
In copy-out and copy-pass modes, read a list of file names terminated
by a null character instead of a newline. This permits gnucpio to
archive files whose names contain newlines.
-a
--reset-access-time
Reset the access times of files after reading them, so that it does
not look like they have just been read.
-A
--append
Append to an existing archive. Only works in copy-out mode. The
archive must be a disk file specified with the options -O or -F.
-b
--swap
In copy-in mode, swap both halfwords of words and bytes of halfwords
in the data. Equivalent to the option -sS. Use this option to convert
32-bit integers between big-endian and little-endian machines.
-B Set the I/O block size to 5,120 bytes. Initially, the block size is
512 bytes.
--block-size=blocks
Set the block size to blocks×512 bytes.
-c Use the old portable (ASCII) archive format.
-C size
--io-size=size
Set the I/O block size to size bytes.
-d
--make-directories
Create leading directories where needed.
-E file
--pattern-file=file
In copy-in mode, read from file additional patterns that specify file
names to extract or list. gnucpio treats the lines of file as if they
had been non-option arguments to gnucpio.
-f
--nonmatching
Copy only the files that do not match any of the given patterns.
-F
--file=archive
Read to or write from archive instead of the standard input or output.
When you use this option, you do not have to specify the output device
for each volume of a multi-volume backup.
--force-local
With options -F, -I, or -O, take the archive file name to be a local
file even if it contains a colon (which ordinarily names a remote
host).
-H format
--format=format
Use archive format format. The valid formats are listed below; gnucpio
also recognizes these names if given in capital letters. The default
in copy-in mode is to detect automatically the archive format, and in
copy-out mode is bin.
bin The obsolete binary format.
odc The old (POSIX.1) portable format.
newc The new (SVR4) portable format, which supports file systems that
have more than 65536 i-nodes.
crc The new (SVR4) portable format with a checksum added.
tar The old tar format.
ustar
The POSIX.1 tar format. Also recognizes GNU tar archives, which
are similar but not identical.
-i
--extract
Run in copy-in mode.
-I archive
Archive file name to use instead of standard input.
-k This option exists only for compatibility with other versions of cpio.
It is ignored.
-l
--link
Whenever possible, link files instead of copying them.
-L
--dereference
Dereference symbolic links -- that is, copy the files that they point
to instead of copying the links.
-m
--preserve-modification-time
Retain previous file-modification times when creating files.
-M message
--message=message
Print message when gnucpio reaches the end of a volume of the back-up
medium (such as a tape or a floppy disk), to prompt the user to insert
a new volume. If message contains the string %d, gnucpio replaces
that string with the number of the current volume (starting at one).
-n
--numeric-uid-gid
In the verbose table of contents listing, show the numeric UID and GID
instead of translating them into names.
--no-preserve-owner
In copy-in and copy-pass modes, do not change the ownership of the
files: leave them owned by the user who extracts them. This is the
default for non-root users, so that users on System-V UNIX do not
inadvertantly give away files.
-o
--create
Run in copy-out mode.
-O archive
Write output into archive instead of to the standard output.
-p
--pass-through
Run in copy-pass mode.
-r
--rename
Interactively rename files.
-R [user][:.][group]
--owner [user][:.][group]
In copy-out and copy-pass modes, set the ownership of all files
created to user and group. Either the user or the group, or both, must
be present. If the group is omitted but the `:' or `.' separator is
given, gnucpio uses the user's login group. Only the super-user can
change files' ownership.
-s
--swap-bytes
In copy-in mode, swap the bytes of each halfword (pair of bytes) in
the files.
-S
--swap-halfwords
In copy-in mode, swap the halfwords of each word (four bytes) in the
files.
-t
--list
Print a table of contents of the input.
-u
--unconditional
Replace all files, without asking whether to replace existing newer
files with older files.
-v
--verbose
List the files processed. When used with the option -t, give a
listing that resembles the output of the command ls -l. In a verbose
table of contents of a ustar archive, user and group names in the
archive that do not exist on the local system are replaced by the
names that correspond locally to the numeric UID and GID stored in the
archive.
-V --dot
Print a `.' for each file processed.
--version
Print the number of the version of gnucpio that you are now running,
and exit.
Examples
The following command copies all files and directories listed by the
command find and copies them into the archive newfile.cpio:
find . -print | cpio -oc > ../newfile.cpio
The following command reads the cpio archive newfile.cpio and extracts all
files whose names match the patterns memo/al or memo/b*:
cpio -icdv "memo/al" "memo/b*" <../newfile.cpio
Note that the -d option forces cpio to create the sub-directory memo and
write the files into it. Otherwise, the files would have been written into
the current directory. Option -v causes cpio to display each file name as
it is extracted from the archive.
The following commands perform a multi-volume backup of all files on
mounted filesystem /v to the character-special (i.e., ``raw'') floppy
device /dev/rfha0:
su root
cd /v
find . -print | cpio -ocv >/dev/rfha0
If the cpio archive exceeds one floppy disk, you will be prompted to insert
another.
See Also
commands,
cpio,
gtar
Notes
COHERENT does not yet support networking. The above descriptions of host
addressing do not yet apply.
gnucpio is released under the conditions of the Free Software Foundation's
``copyleft''. Full source code is available through the Mark Williams
bulletin board.







