2012-10-22 16:10:38 +02:00
|
|
|
.\" $NetBSD: cpio.1,v 1.13 2011/06/19 07:34:24 wiz Exp $
|
|
|
|
.\"
|
2010-02-24 12:58:10 +01:00
|
|
|
.\" Copyright (c) 1997 SigmaSoft, Th. Lockert
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
2012-10-22 16:10:38 +02:00
|
|
|
.\" OpenBSD: cpio.1,v 1.14 2000/11/10 17:52:02 aaron Exp
|
2010-02-24 12:58:10 +01:00
|
|
|
.\"
|
2012-10-22 16:10:38 +02:00
|
|
|
.Dd June 18, 2011
|
2010-02-24 12:58:10 +01:00
|
|
|
.Dt CPIO 1
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm cpio
|
|
|
|
.Nd copy file archives in and out
|
|
|
|
.Sh SYNOPSIS
|
2012-10-22 16:10:38 +02:00
|
|
|
.Nm cpio
|
2010-02-24 12:58:10 +01:00
|
|
|
.Fl o
|
2012-10-22 16:10:38 +02:00
|
|
|
.Op Fl AaBcLvZz
|
2010-02-24 12:58:10 +01:00
|
|
|
.Op Fl C Ar bytes
|
|
|
|
.Op Fl F Ar archive
|
|
|
|
.Op Fl H Ar format
|
|
|
|
.Op Fl O Ar archive
|
2012-10-22 16:10:38 +02:00
|
|
|
.Ar "\*[Lt] name-list"
|
|
|
|
.Op Ar "\*[Gt] archive"
|
|
|
|
.Nm cpio
|
2010-02-24 12:58:10 +01:00
|
|
|
.Fl i
|
2012-10-22 16:10:38 +02:00
|
|
|
.Op Fl 6BbcdfmrSstuvZz
|
2010-02-24 12:58:10 +01:00
|
|
|
.Op Fl C Ar bytes
|
|
|
|
.Op Fl E Ar file
|
|
|
|
.Op Fl F Ar archive
|
|
|
|
.Op Fl H Ar format
|
|
|
|
.Op Fl I Ar archive
|
2012-10-22 16:10:38 +02:00
|
|
|
.Op Ar "pattern ..."
|
|
|
|
.Op Ar "\*[Lt] archive"
|
|
|
|
.Nm cpio
|
2010-02-24 12:58:10 +01:00
|
|
|
.Fl p
|
2012-10-22 16:10:38 +02:00
|
|
|
.Op Fl adLlmuv
|
2010-02-24 12:58:10 +01:00
|
|
|
.Ar destination-directory
|
2012-10-22 16:10:38 +02:00
|
|
|
.Ar "\*[Lt] name-list"
|
2010-02-24 12:58:10 +01:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
command copies files to and from a
|
|
|
|
.Nm
|
|
|
|
archive.
|
2012-10-22 16:10:38 +02:00
|
|
|
If the archive is of the form:
|
|
|
|
.Ar [[user@]host:]file
|
|
|
|
then the archive will be processed using
|
|
|
|
.Xr rmt 8 .
|
2010-02-24 12:58:10 +01:00
|
|
|
.Pp
|
|
|
|
The options are as follows:
|
2012-10-22 16:10:38 +02:00
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl o , Fl Fl create
|
2010-02-24 12:58:10 +01:00
|
|
|
Create an archive.
|
|
|
|
Reads the list of files to store in the
|
|
|
|
archive from standard input, and writes the archive on standard
|
|
|
|
output.
|
2012-10-22 16:10:38 +02:00
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl a , Fl Fl reset-access-time
|
2010-02-24 12:58:10 +01:00
|
|
|
Reset the access times on files that have been copied to the
|
|
|
|
archive.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl A , Fl Fl append
|
2010-02-24 12:58:10 +01:00
|
|
|
Append to the specified archive.
|
|
|
|
.It Fl B
|
|
|
|
Set block size of output to 5120 bytes.
|
|
|
|
.It Fl c
|
2012-10-22 16:10:38 +02:00
|
|
|
Use ASCII format for
|
2010-02-24 12:58:10 +01:00
|
|
|
.Nm
|
|
|
|
header for portability.
|
|
|
|
.It Fl C Ar bytes
|
|
|
|
Set the block size of output to
|
|
|
|
.Ar bytes .
|
|
|
|
.It Fl F Ar archive
|
|
|
|
.It Fl O Ar archive
|
|
|
|
Use the specified file name as the archive to write to.
|
|
|
|
.It Fl H Ar format
|
|
|
|
Write the archive in the specified format.
|
|
|
|
Recognized formats are:
|
|
|
|
.Pp
|
|
|
|
.Bl -tag -width sv4cpio -compact
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Ar bcpio
|
2010-02-24 12:58:10 +01:00
|
|
|
Old binary
|
|
|
|
.Nm
|
|
|
|
format.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Ar cpio
|
2010-02-24 12:58:10 +01:00
|
|
|
Old octal character
|
|
|
|
.Nm
|
|
|
|
format.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Ar sv4cpio
|
|
|
|
SVR4 hex
|
2010-02-24 12:58:10 +01:00
|
|
|
.Nm
|
|
|
|
format.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Ar tar
|
2010-02-24 12:58:10 +01:00
|
|
|
Old tar format.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Ar ustar
|
|
|
|
POSIX ustar format.
|
2010-02-24 12:58:10 +01:00
|
|
|
.El
|
|
|
|
.It Fl L
|
|
|
|
Follow symbolic links.
|
|
|
|
.It Fl v
|
|
|
|
Be verbose about operations.
|
|
|
|
List filenames as they are written to the archive.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl Fl xz
|
|
|
|
Compress/decompress archive using
|
|
|
|
.Xr xz 1
|
2010-02-24 12:58:10 +01:00
|
|
|
format.
|
|
|
|
.It Fl Z
|
|
|
|
Compress archive using
|
|
|
|
.Xr compress 1
|
|
|
|
format.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl z
|
|
|
|
Compress/decompress archive using
|
|
|
|
.Xr gzip 1
|
|
|
|
format.
|
2010-02-24 12:58:10 +01:00
|
|
|
.El
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl i , Fl Fl extract
|
2010-02-24 12:58:10 +01:00
|
|
|
Restore files from an archive.
|
|
|
|
Reads the archive file from
|
|
|
|
standard input and extracts files matching the
|
|
|
|
.Ar patterns
|
|
|
|
that were specified on the command line.
|
2012-10-22 16:10:38 +02:00
|
|
|
.Bl -tag -width Ds
|
2010-02-24 12:58:10 +01:00
|
|
|
.It Fl b
|
|
|
|
Do byte and word swapping after reading in data from the
|
|
|
|
archive, for restoring archives created on systems with
|
|
|
|
a different byte order.
|
|
|
|
.It Fl B
|
|
|
|
Set the block size of the archive being read to 5120 bytes.
|
|
|
|
.It Fl c
|
2012-10-22 16:10:38 +02:00
|
|
|
Expect the archive headers to be in ASCII format.
|
2010-02-24 12:58:10 +01:00
|
|
|
.It Fl C Ar bytes
|
|
|
|
Read archive written with a block size of
|
|
|
|
.Ar bytes .
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl d , Fl Fl make-directories
|
2010-02-24 12:58:10 +01:00
|
|
|
Create any intermediate directories as needed during
|
|
|
|
restore.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl E Ar file , Fl Fl pattern-file Ar file
|
2010-02-24 12:58:10 +01:00
|
|
|
Read list of file name patterns to extract or list from
|
|
|
|
.Ar file .
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl f , Fl Fl nonmatching
|
2010-02-24 12:58:10 +01:00
|
|
|
Restore all files except those matching the
|
|
|
|
.Ar patterns
|
|
|
|
given on the command line.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl F Ar archive , Fl Fl file Ar archive
|
|
|
|
.It Fl I Ar archive
|
2010-02-24 12:58:10 +01:00
|
|
|
Use the specified file as the input for the archive.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl H Ar format , Fl Fl format Ar format
|
2010-02-24 12:58:10 +01:00
|
|
|
Read an archive of the specified format.
|
|
|
|
Recognized formats are:
|
|
|
|
.Pp
|
|
|
|
.Bl -tag -width sv4cpio -compact
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Ar bcpio
|
2010-02-24 12:58:10 +01:00
|
|
|
Old binary
|
|
|
|
.Nm
|
|
|
|
format.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Ar cpio
|
2010-02-24 12:58:10 +01:00
|
|
|
Old octal character
|
|
|
|
.Nm
|
|
|
|
format.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Ar sv4cpio
|
|
|
|
SVR4 hex
|
2010-02-24 12:58:10 +01:00
|
|
|
.Nm
|
|
|
|
format.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Ar tar
|
2010-02-24 12:58:10 +01:00
|
|
|
Old tar format.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Ar ustar
|
|
|
|
POSIX ustar format.
|
2010-02-24 12:58:10 +01:00
|
|
|
.El
|
|
|
|
.It Fl m
|
|
|
|
Restore modification times on files.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl r , Fl Fl rename
|
2010-02-24 12:58:10 +01:00
|
|
|
Rename restored files interactively.
|
|
|
|
.It Fl s
|
|
|
|
Swap bytes after reading data from the archive.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl S , Fl Fl swap-halfwords
|
2010-02-24 12:58:10 +01:00
|
|
|
Swap words after reading data from the archive.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl t , Fl Fl list
|
2010-02-24 12:58:10 +01:00
|
|
|
Only list the contents of the archive, no files or
|
|
|
|
directories will be created.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl u , Fl Fl unconditional
|
2010-02-24 12:58:10 +01:00
|
|
|
Overwrite files even when the file in the archive is
|
|
|
|
older than the one that will be overwritten.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl v , Fl Fl verbose
|
2010-02-24 12:58:10 +01:00
|
|
|
Be verbose about operations.
|
|
|
|
List filenames as they are copied in from the archive.
|
|
|
|
.It Fl z
|
|
|
|
Uncompress archive using
|
|
|
|
.Xr gzip 1
|
|
|
|
format.
|
|
|
|
.It Fl Z
|
|
|
|
Uncompress archive using
|
|
|
|
.Xr compress 1
|
|
|
|
format.
|
|
|
|
.It Fl 6
|
|
|
|
Process old-style
|
|
|
|
.Nm
|
|
|
|
format archives.
|
|
|
|
.El
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl p , Fl Fl pass-through
|
2010-02-24 12:58:10 +01:00
|
|
|
Copy files from one location to another in a single pass.
|
|
|
|
The list of files to copy are read from standard input and
|
|
|
|
written out to a directory relative to the specified
|
|
|
|
.Ar directory
|
|
|
|
argument.
|
2012-10-22 16:10:38 +02:00
|
|
|
.Bl -tag -width Ds
|
2010-02-24 12:58:10 +01:00
|
|
|
.It Fl a
|
|
|
|
Reset the access times on files that have been copied.
|
|
|
|
.It Fl d
|
|
|
|
Create any intermediate directories as needed to write
|
|
|
|
the files at the new location.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl l , Fl Fl link
|
2010-02-24 12:58:10 +01:00
|
|
|
When possible, link files rather than creating an
|
|
|
|
extra copy.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl L , Fl Fl dereference
|
2010-02-24 12:58:10 +01:00
|
|
|
Follow symbolic links.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl m , Fl Fl preserve-modification-time
|
2010-02-24 12:58:10 +01:00
|
|
|
Restore modification times on files.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl u , Fl Fl unconditional
|
2010-02-24 12:58:10 +01:00
|
|
|
Overwrite files even when the original file being copied is
|
|
|
|
older than the one that will be overwritten.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl v , Fl Fl verbose
|
2010-02-24 12:58:10 +01:00
|
|
|
Be verbose about operations.
|
|
|
|
List filenames as they are copied.
|
2012-10-22 16:10:38 +02:00
|
|
|
.It Fl Fl force-local
|
|
|
|
Do not interpret filenames that contain a
|
|
|
|
.Sq \&:
|
|
|
|
as remote files.
|
|
|
|
.It Fl Fl insecure
|
|
|
|
Normally
|
|
|
|
.Nm
|
|
|
|
ignores filenames that contain
|
|
|
|
.Dq ..
|
|
|
|
as a path component.
|
|
|
|
With this option, files that contain
|
|
|
|
.Dq ..
|
|
|
|
can be processed.
|
2010-02-24 12:58:10 +01:00
|
|
|
.El
|
|
|
|
.El
|
|
|
|
.Sh EXIT STATUS
|
|
|
|
.Nm
|
2012-10-22 16:10:38 +02:00
|
|
|
will exit with one of the following values:
|
2010-02-24 12:58:10 +01:00
|
|
|
.Bl -tag -width 2n
|
|
|
|
.It 0
|
|
|
|
All files were processed successfully.
|
|
|
|
.It 1
|
|
|
|
An error occurred.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Whenever
|
|
|
|
.Nm
|
|
|
|
cannot create a file or a link when extracting an archive or cannot
|
|
|
|
find a file while writing an archive, or cannot preserve the user
|
|
|
|
ID, group ID, file mode, or access and modification times when the
|
|
|
|
.Fl p
|
|
|
|
option is specified, a diagnostic message is written to standard
|
|
|
|
error and a non-zero exit value will be returned, but processing
|
|
|
|
will continue.
|
|
|
|
In the case where
|
|
|
|
.Nm
|
|
|
|
cannot create a link to a file,
|
|
|
|
.Nm
|
|
|
|
will not create a second copy of the file.
|
|
|
|
.Pp
|
|
|
|
If the extraction of a file from an archive is prematurely terminated
|
|
|
|
by a signal or error,
|
|
|
|
.Nm
|
|
|
|
may have only partially extracted the file the user wanted.
|
|
|
|
Additionally, the file modes of extracted files and directories may
|
|
|
|
have incorrect file bits, and the modification and access times may
|
|
|
|
be wrong.
|
|
|
|
.Pp
|
|
|
|
If the creation of an archive is prematurely terminated by a signal
|
|
|
|
or error,
|
|
|
|
.Nm
|
|
|
|
may have only partially created the archive which may violate the
|
|
|
|
specific archive format specification.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr pax 1 ,
|
|
|
|
.Xr tar 1
|
|
|
|
.Sh AUTHORS
|
2012-10-22 16:10:38 +02:00
|
|
|
Keith Muller at the University of California, San Diego.
|
2010-02-24 12:58:10 +01:00
|
|
|
.Sh BUGS
|
|
|
|
The
|
|
|
|
.Fl s
|
|
|
|
and
|
|
|
|
.Fl S
|
|
|
|
options are currently not implemented.
|