Blame doc/text/bsdcpio.1.txt

Packit Service 1d0348
CPIO(1) 		  BSD General Commands Manual		       CPIO(1)
Packit Service 1d0348
Packit Service 1d0348
NAME
Packit Service 1d0348
     cpio — copy files to and from archives
Packit Service 1d0348
Packit Service 1d0348
SYNOPSIS
Packit Service 1d0348
     cpio -i [options] [pattern ...] [< archive]
Packit Service 1d0348
     cpio -o [options] < name-list [> archive]
Packit Service 1d0348
     cpio -p [options] dest-dir < name-list
Packit Service 1d0348
Packit Service 1d0348
DESCRIPTION
Packit Service 1d0348
     cpio copies files between archives and directories.  This implementation
Packit Service 1d0348
     can extract from tar, pax, cpio, zip, jar, ar, and ISO 9660 cdrom images
Packit Service 1d0348
     and can create tar, pax, cpio, ar, and shar archives.
Packit Service 1d0348
Packit Service 1d0348
     The first option to cpio is a mode indicator from the following list:
Packit Service 1d0348
     -i      Input.  Read an archive from standard input (unless overridden)
Packit Service 1d0348
	     and extract the contents to disk or (if the -t option is speci‐
Packit Service 1d0348
	     fied) list the contents to standard output.  If one or more file
Packit Service 1d0348
	     patterns are specified, only files matching one of the patterns
Packit Service 1d0348
	     will be extracted.
Packit Service 1d0348
     -o      Output.  Read a list of filenames from standard input and produce
Packit Service 1d0348
	     a new archive on standard output (unless overridden) containing
Packit Service 1d0348
	     the specified items.
Packit Service 1d0348
     -p      Pass-through.  Read a list of filenames from standard input and
Packit Service 1d0348
	     copy the files to the specified directory.
Packit Service 1d0348
Packit Service 1d0348
OPTIONS
Packit Service 1d0348
     Unless specifically stated otherwise, options are applicable in all oper‐
Packit Service 1d0348
     ating modes.
Packit Service 1d0348
Packit Service 1d0348
     -0, --null
Packit Service 1d0348
	     Read filenames separated by NUL characters instead of newlines.
Packit Service 1d0348
	     This is necessary if any of the filenames being read might con‐
Packit Service 1d0348
	     tain newlines.
Packit Service 1d0348
Packit Service 1d0348
     -A      (o mode only) Append to the specified archive.  (Not yet imple‐
Packit Service 1d0348
	     mented.)
Packit Service 1d0348
Packit Service 1d0348
     -a      (o and p modes) Reset access times on files after they are read.
Packit Service 1d0348
Packit Service 1d0348
     -B      (o mode only) Block output to records of 5120 bytes.
Packit Service 1d0348
Packit Service 1d0348
     -C size
Packit Service 1d0348
	     (o mode only) Block output to records of size bytes.
Packit Service 1d0348
Packit Service 1d0348
     -c      (o mode only) Use the old POSIX portable character format.
Packit Service 1d0348
	     Equivalent to --format odc.
Packit Service 1d0348
Packit Service 1d0348
     -d, --make-directories
Packit Service 1d0348
	     (i and p modes) Create directories as necessary.
Packit Service 1d0348
Packit Service 1d0348
     -E file
Packit Service 1d0348
	     (i mode only) Read list of file name patterns from file to list
Packit Service 1d0348
	     and extract.
Packit Service 1d0348
Packit Service 1d0348
     -F file, --file file
Packit Service 1d0348
	     Read archive from or write archive to file.
Packit Service 1d0348
Packit Service 1d0348
     -f pattern
Packit Service 1d0348
	     (i mode only) Ignore files that match pattern.
Packit Service 1d0348
Packit Service 1d0348
     -H format, --format format
Packit Service 1d0348
	     (o mode only) Produce the output archive in the specified format.
Packit Service 1d0348
	     Supported formats include:
Packit Service 1d0348
Packit Service 1d0348
	     cpio     Synonym for odc.
Packit Service 1d0348
	     newc     The SVR4 portable cpio format.
Packit Service 1d0348
	     odc      The old POSIX.1 portable octet-oriented cpio format.
Packit Service 1d0348
	     pax      The POSIX.1 pax format, an extension of the ustar for‐
Packit Service 1d0348
		      mat.
Packit Service 1d0348
	     ustar    The POSIX.1 tar format.
Packit Service 1d0348
Packit Service 1d0348
	     The default format is odc.  See libarchive-formats(5) for more
Packit Service 1d0348
	     complete information about the formats currently supported by the
Packit Service 1d0348
	     underlying libarchive(3) library.
Packit Service 1d0348
Packit Service 1d0348
     -h, --help
Packit Service 1d0348
	     Print usage information.
Packit Service 1d0348
Packit Service 1d0348
     -I file
Packit Service 1d0348
	     Read archive from file.
Packit Service 1d0348
Packit Service 1d0348
     -i, --extract
Packit Service 1d0348
	     Input mode.  See above for description.
Packit Service 1d0348
Packit Service 1d0348
     --insecure
Packit Service 1d0348
	     (i and p mode only) Disable security checks during extraction or
Packit Service 1d0348
	     copying.  This allows extraction via symbolic links, absolute
Packit Service 1d0348
	     paths, and path names containing ‘..’ in the name.
Packit Service 1d0348
Packit Service 1d0348
     -J, --xz
Packit Service 1d0348
	     (o mode only) Compress the file with xz-compatible compression
Packit Service 1d0348
	     before writing it.  In input mode, this option is ignored; xz
Packit Service 1d0348
	     compression is recognized automatically on input.
Packit Service 1d0348
Packit Service 1d0348
     -j      Synonym for -y.
Packit Service 1d0348
Packit Service 1d0348
     -L      (o and p modes) All symbolic links will be followed.  Normally,
Packit Service 1d0348
	     symbolic links are archived and copied as symbolic links.	With
Packit Service 1d0348
	     this option, the target of the link will be archived or copied
Packit Service 1d0348
	     instead.
Packit Service 1d0348
Packit Service 1d0348
     -l, --link
Packit Service 1d0348
	     (p mode only) Create links from the target directory to the orig‐
Packit Service 1d0348
	     inal files, instead of copying.
Packit Service 1d0348
Packit Service 1d0348
     --lrzip
Packit Service 1d0348
	     (o mode only) Compress the resulting archive with lrzip(1).  In
Packit Service 1d0348
	     input mode, this option is ignored.
Packit Service 1d0348
Packit Service 1d0348
     --lz4   (o mode only) Compress the archive with lz4-compatible compres‐
Packit Service 1d0348
	     sion before writing it.  In input mode, this option is ignored;
Packit Service 1d0348
	     lz4 compression is recognized automatically on input.
Packit Service 1d0348
Packit Service 1d0348
     --zstd  (o mode only) Compress the archive with zstd-compatible compres‐
Packit Service 1d0348
	     sion before writing it.  In input mode, this option is ignored;
Packit Service 1d0348
	     zstd compression is recognized automatically on input.
Packit Service 1d0348
Packit Service 1d0348
     --lzma  (o mode only) Compress the file with lzma-compatible compression
Packit Service 1d0348
	     before writing it.  In input mode, this option is ignored; lzma
Packit Service 1d0348
	     compression is recognized automatically on input.
Packit Service 1d0348
Packit Service 1d0348
     --lzop  (o mode only) Compress the resulting archive with lzop(1).  In
Packit Service 1d0348
	     input mode, this option is ignored.
Packit Service 1d0348
Packit Service 1d0348
     --passphrase passphrase
Packit Service 1d0348
	     The passphrase is used to extract or create an encrypted archive.
Packit Service 1d0348
	     Currently, zip is only a format that cpio can handle encrypted
Packit Service 1d0348
	     archives.	You shouldn't use this option unless you realize how
Packit Service 1d0348
	     insecure use of this option is.
Packit Service 1d0348
Packit Service 1d0348
     -m, --preserve-modification-time
Packit Service 1d0348
	     (i and p modes) Set file modification time on created files to
Packit Service 1d0348
	     match those in the source.
Packit Service 1d0348
Packit Service 1d0348
     -n, --numeric-uid-gid
Packit Service 1d0348
	     (i mode, only with -t) Display numeric uid and gid.  By default,
Packit Service 1d0348
	     cpio displays the user and group names when they are provided in
Packit Service 1d0348
	     the archive, or looks up the user and group names in the system
Packit Service 1d0348
	     password database.
Packit Service 1d0348
Packit Service 1d0348
     --no-preserve-owner
Packit Service 1d0348
	     (i mode only) Do not attempt to restore file ownership.  This is
Packit Service 1d0348
	     the default when run by non-root users.
Packit Service 1d0348
Packit Service 1d0348
     -O file
Packit Service 1d0348
	     Write archive to file.
Packit Service 1d0348
Packit Service 1d0348
     -o, --create
Packit Service 1d0348
	     Output mode.  See above for description.
Packit Service 1d0348
Packit Service 1d0348
     -p, --pass-through
Packit Service 1d0348
	     Pass-through mode.  See above for description.
Packit Service 1d0348
Packit Service 1d0348
     --preserve-owner
Packit Service 1d0348
	     (i mode only) Restore file ownership.  This is the default when
Packit Service 1d0348
	     run by the root user.
Packit Service 1d0348
Packit Service 1d0348
     --quiet
Packit Service 1d0348
	     Suppress unnecessary messages.
Packit Service 1d0348
Packit Service 1d0348
     -R [user][:][group], --owner [user][:][group]
Packit Service 1d0348
	     Set the owner and/or group on files in the output.  If group is
Packit Service 1d0348
	     specified with no user (for example, -R :wheel) then the group
Packit Service 1d0348
	     will be set but not the user.  If the user is specified with a
Packit Service 1d0348
	     trailing colon and no group (for example, -R root:) then the
Packit Service 1d0348
	     group will be set to the user's default group.  If the user is
Packit Service 1d0348
	     specified with no trailing colon, then the user will be set but
Packit Service 1d0348
	     not the group.  In -i and -p modes, this option can only be used
Packit Service 1d0348
	     by the super-user.  (For compatibility, a period can be used in
Packit Service 1d0348
	     place of the colon.)
Packit Service 1d0348
Packit Service 1d0348
     -r      (All modes.)  Rename files interactively.	For each file, a
Packit Service 1d0348
	     prompt is written to /dev/tty containing the name of the file and
Packit Service 1d0348
	     a line is read from /dev/tty.  If the line read is blank, the
Packit Service 1d0348
	     file is skipped.  If the line contains a single period, the file
Packit Service 1d0348
	     is processed normally.  Otherwise, the line is taken to be the
Packit Service 1d0348
	     new name of the file.
Packit Service 1d0348
Packit Service 1d0348
     -t, --list
Packit Service 1d0348
	     (i mode only) List the contents of the archive to stdout; do not
Packit Service 1d0348
	     restore the contents to disk.
Packit Service 1d0348
Packit Service 1d0348
     -u, --unconditional
Packit Service 1d0348
	     (i and p modes) Unconditionally overwrite existing files.	Ordi‐
Packit Service 1d0348
	     narily, an older file will not overwrite a newer file on disk.
Packit Service 1d0348
Packit Service 1d0348
     -V, --dot
Packit Service 1d0348
	     Print a dot to stderr for each file as it is processed.  Super‐
Packit Service 1d0348
	     seded by -v.
Packit Service 1d0348
Packit Service 1d0348
     -v, --verbose
Packit Service 1d0348
	     Print the name of each file to stderr as it is processed.	With
Packit Service 1d0348
	     -t, provide a detailed listing of each file.
Packit Service 1d0348
Packit Service 1d0348
     --version
Packit Service 1d0348
	     Print the program version information and exit.
Packit Service 1d0348
Packit Service 1d0348
     -y      (o mode only) Compress the archive with bzip2-compatible compres‐
Packit Service 1d0348
	     sion before writing it.  In input mode, this option is ignored;
Packit Service 1d0348
	     bzip2 compression is recognized automatically on input.
Packit Service 1d0348
Packit Service 1d0348
     -Z      (o mode only) Compress the archive with compress-compatible com‐
Packit Service 1d0348
	     pression before writing it.  In input mode, this option is
Packit Service 1d0348
	     ignored; compression is recognized automatically on input.
Packit Service 1d0348
Packit Service 1d0348
     -z      (o mode only) Compress the archive with gzip-compatible compres‐
Packit Service 1d0348
	     sion before writing it.  In input mode, this option is ignored;
Packit Service 1d0348
	     gzip compression is recognized automatically on input.
Packit Service 1d0348
Packit Service 1d0348
EXIT STATUS
Packit Service 1d0348
     The cpio utility exits 0 on success, and >0 if an error occurs.
Packit Service 1d0348
Packit Service 1d0348
ENVIRONMENT
Packit Service 1d0348
     The following environment variables affect the execution of cpio:
Packit Service 1d0348
Packit Service 1d0348
     LANG	The locale to use.  See environ(7) for more information.
Packit Service 1d0348
Packit Service 1d0348
     TZ 	The timezone to use when displaying dates.  See environ(7) for
Packit Service 1d0348
		more information.
Packit Service 1d0348
Packit Service 1d0348
EXAMPLES
Packit Service 1d0348
     The cpio command is traditionally used to copy file hierarchies in con‐
Packit Service 1d0348
     junction with the find(1) command.  The first example here simply copies
Packit Service 1d0348
     all files from src to dest:
Packit Service 1d0348
	   find src | cpio -pmud dest
Packit Service 1d0348
Packit Service 1d0348
     By carefully selecting options to the find(1) command and combining it
Packit Service 1d0348
     with other standard utilities, it is possible to exercise very fine con‐
Packit Service 1d0348
     trol over which files are copied.	This next example copies files from
Packit Service 1d0348
     src to dest that are more than 2 days old and whose names match a partic‐
Packit Service 1d0348
     ular pattern:
Packit Service 1d0348
	   find src -mtime +2 | grep foo[bar] | cpio -pdmu dest
Packit Service 1d0348
Packit Service 1d0348
     This example copies files from src to dest that are more than 2 days old
Packit Service 1d0348
     and which contain the word “foobar”:
Packit Service 1d0348
	   find src -mtime +2 | xargs grep -l foobar | cpio -pdmu dest
Packit Service 1d0348
Packit Service 1d0348
COMPATIBILITY
Packit Service 1d0348
     The mode options i, o, and p and the options a, B, c, d, f, l, m, r, t,
Packit Service 1d0348
     u, and v comply with SUSv2.
Packit Service 1d0348
Packit Service 1d0348
     The old POSIX.1 standard specified that only -i, -o, and -p were inter‐
Packit Service 1d0348
     preted as command-line options.  Each took a single argument of a list of
Packit Service 1d0348
     modifier characters.  For example, the standard syntax allows -imu but
Packit Service 1d0348
     does not support -miu or -i -m -u, since m and u are only modifiers to
Packit Service 1d0348
     -i, they are not command-line options in their own right.	The syntax
Packit Service 1d0348
     supported by this implementation is backwards-compatible with the stan‐
Packit Service 1d0348
     dard.  For best compatibility, scripts should limit themselves to the
Packit Service 1d0348
     standard syntax.
Packit Service 1d0348
Packit Service 1d0348
SEE ALSO
Packit Service 1d0348
     bzip2(1), tar(1), gzip(1), mt(1), pax(1), libarchive(3), cpio(5),
Packit Service 1d0348
     libarchive-formats(5), tar(5)
Packit Service 1d0348
Packit Service 1d0348
STANDARDS
Packit Service 1d0348
     There is no current POSIX standard for the cpio command; it appeared in
Packit Service 1d0348
     ISO/IEC 9945-1:1996 (“POSIX.1”) but was dropped from IEEE Std 1003.1-2001
Packit Service 1d0348
     (“POSIX.1”).
Packit Service 1d0348
Packit Service 1d0348
     The cpio, ustar, and pax interchange file formats are defined by IEEE Std
Packit Service 1d0348
     1003.1-2001 (“POSIX.1”) for the pax command.
Packit Service 1d0348
Packit Service 1d0348
HISTORY
Packit Service 1d0348
     The original cpio and find utilities were written by Dick Haight while
Packit Service 1d0348
     working in AT&T's Unix Support Group.  They first appeared in 1977 in
Packit Service 1d0348
     PWB/UNIX 1.0, the “Programmer's Work Bench” system developed for use
Packit Service 1d0348
     within AT&T.  They were first released outside of AT&T as part of System
Packit Service 1d0348
     III Unix in 1981.	As a result, cpio actually predates tar, even though
Packit Service 1d0348
     it was not well-known outside of AT&T until some time later.
Packit Service 1d0348
Packit Service 1d0348
     This is a complete re-implementation based on the libarchive(3) library.
Packit Service 1d0348
Packit Service 1d0348
BUGS
Packit Service 1d0348
     The cpio archive format has several basic limitations: It does not store
Packit Service 1d0348
     user and group names, only numbers.  As a result, it cannot be reliably
Packit Service 1d0348
     used to transfer files between systems with dissimilar user and group
Packit Service 1d0348
     numbering.  Older cpio formats limit the user and group numbers to 16 or
Packit Service 1d0348
     18 bits, which is insufficient for modern systems.  The cpio archive for‐
Packit Service 1d0348
     mats cannot support files over 4 gigabytes, except for the “odc” variant,
Packit Service 1d0348
     which can support files up to 8 gigabytes.
Packit Service 1d0348
Packit Service 1d0348
BSD			      September 16, 2014			   BSD