2002-02-08 04:21:55 +03:00
|
|
|
.\" $NetBSD: pax.1,v 1.31 2002/02/08 01:21:58 ross Exp $
|
1995-03-21 12:01:59 +03:00
|
|
|
.\"
|
1994-06-13 20:13:35 +04:00
|
|
|
.\" Copyright (c) 1992 Keith Muller.
|
|
|
|
.\" Copyright (c) 1992, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to Berkeley by
|
|
|
|
.\" Keith Muller of the University of California, San Diego.
|
|
|
|
.\"
|
|
|
|
.\" 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.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the University of
|
|
|
|
.\" California, Berkeley and its contributors.
|
|
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
|
|
|
|
.\"
|
1995-03-21 12:01:59 +03:00
|
|
|
.\" @(#)pax.1 8.4 (Berkeley) 4/18/94
|
1994-06-13 20:13:35 +04:00
|
|
|
.\"
|
2002-01-24 10:45:33 +03:00
|
|
|
.Dd January 24, 2002
|
1994-06-13 20:13:35 +04:00
|
|
|
.Dt PAX 1
|
1999-03-22 21:25:43 +03:00
|
|
|
.Os
|
1994-06-13 20:13:35 +04:00
|
|
|
.Sh NAME
|
|
|
|
.Nm pax
|
|
|
|
.Nd read and write file archives and copy directory hierarchies
|
|
|
|
.Sh SYNOPSIS
|
1999-03-07 13:48:31 +03:00
|
|
|
.Nm ""
|
2000-03-30 21:53:04 +04:00
|
|
|
.Op Fl cdnvzO
|
1994-06-13 20:13:35 +04:00
|
|
|
.Bk -words
|
1999-03-07 04:07:57 +03:00
|
|
|
.Op Fl E Ar limit
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1994-06-13 20:13:35 +04:00
|
|
|
.Op Fl f Ar archive
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2002-01-24 10:45:33 +03:00
|
|
|
.Op Fl N Ar dbdir
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1994-06-13 20:13:35 +04:00
|
|
|
.Op Fl s Ar replstr
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl U Ar user
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl G Ar group
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Oo
|
|
|
|
.Fl T
|
|
|
|
.Op Ar from_date
|
1999-03-07 22:58:45 +03:00
|
|
|
.Sm off
|
|
|
|
.Oo , Ar to_date Oc
|
|
|
|
.Sm on
|
1994-06-13 20:13:35 +04:00
|
|
|
.Oc
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
1999-03-07 04:07:57 +03:00
|
|
|
.Op Ar pattern ...\&
|
1997-10-20 12:50:59 +04:00
|
|
|
.Nm ""
|
1994-06-13 20:13:35 +04:00
|
|
|
.Fl r
|
2000-03-30 21:53:04 +04:00
|
|
|
.Op Fl cdiknuvzADOYZ
|
1994-06-13 20:13:35 +04:00
|
|
|
.Bk -words
|
1999-03-07 04:07:57 +03:00
|
|
|
.Op Fl E Ar limit
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1994-06-13 20:13:35 +04:00
|
|
|
.Op Fl f Ar archive
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2002-01-24 10:45:33 +03:00
|
|
|
.Op Fl N Ar dbdir
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1994-06-13 20:13:35 +04:00
|
|
|
.Op Fl o Ar options
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl p Ar string
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl s Ar replstr
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl U Ar user
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl G Ar group
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Oo
|
|
|
|
.Fl T
|
|
|
|
.Op Ar from_date
|
1999-03-07 22:58:45 +03:00
|
|
|
.Sm off
|
|
|
|
.Oo , Ar to_date Oc
|
|
|
|
.Sm on
|
1994-06-13 20:13:35 +04:00
|
|
|
.Oc
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
1999-03-07 04:07:57 +03:00
|
|
|
.Op Ar pattern ...\&
|
1997-10-20 12:50:59 +04:00
|
|
|
.Nm ""
|
1994-06-13 20:13:35 +04:00
|
|
|
.Fl w
|
Implement -M flag: During a write or copy operation, treat the list of
files on standard input as an mtree(8) `specfile' specification, and
write or copy only those items in the specfile.
If the file exists in the underlying file system, its permissions and
modification time will be used unless specifically overridden by the
specfile. An error will be raised if the type of entry in the specfile
conflicts with that of an existing file.
Otherwise, it is necessary to specify at least the following parameters
in the specfile: type, mode, gname or gid, and uname or uid, device
(in the case of block or character devices), and link (in the case of
symbolic links). If time isn't provided, the current time will be used.
2001-10-25 12:51:50 +04:00
|
|
|
.Op Fl dituvzAHLMOPX
|
1994-06-13 20:13:35 +04:00
|
|
|
.Bk -words
|
|
|
|
.Op Fl b Ar blocksize
|
|
|
|
.Ek
|
|
|
|
.Oo
|
|
|
|
.Op Fl a
|
|
|
|
.Op Fl f Ar archive
|
|
|
|
.Oc
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl x Ar format
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1999-03-07 04:07:57 +03:00
|
|
|
.Op Fl B Ar bytes
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2002-01-24 10:45:33 +03:00
|
|
|
.Op Fl N Ar dbdir
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1994-06-13 20:13:35 +04:00
|
|
|
.Op Fl o Ar options
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1999-03-07 04:07:57 +03:00
|
|
|
.Op Fl s Ar replstr
|
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1999-03-07 04:07:57 +03:00
|
|
|
.Op Fl U Ar user
|
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1999-03-07 04:07:57 +03:00
|
|
|
.Op Fl G Ar group
|
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Oo
|
|
|
|
.Fl T
|
|
|
|
.Op Ar from_date
|
1999-03-07 14:02:05 +03:00
|
|
|
.Sm off
|
1999-03-07 22:58:45 +03:00
|
|
|
.Oo , Ar to_date Oc
|
|
|
|
.Oo /[ Cm c ] [ Cm m ] Oc
|
1999-03-07 14:02:05 +03:00
|
|
|
.Sm on
|
1994-06-13 20:13:35 +04:00
|
|
|
.Oc
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
1999-03-07 04:07:57 +03:00
|
|
|
.Op Ar file ...\&
|
1997-10-20 12:50:59 +04:00
|
|
|
.Nm ""
|
1994-06-13 20:13:35 +04:00
|
|
|
.Fl r
|
|
|
|
.Fl w
|
Implement -M flag: During a write or copy operation, treat the list of
files on standard input as an mtree(8) `specfile' specification, and
write or copy only those items in the specfile.
If the file exists in the underlying file system, its permissions and
modification time will be used unless specifically overridden by the
specfile. An error will be raised if the type of entry in the specfile
conflicts with that of an existing file.
Otherwise, it is necessary to specify at least the following parameters
in the specfile: type, mode, gname or gid, and uname or uid, device
(in the case of block or character devices), and link (in the case of
symbolic links). If time isn't provided, the current time will be used.
2001-10-25 12:51:50 +04:00
|
|
|
.Op Fl diklntuvzADHLMOPXYZ
|
1994-06-13 20:13:35 +04:00
|
|
|
.Bk -words
|
2002-01-24 10:45:33 +03:00
|
|
|
.Op Fl N Ar dbdir
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
1994-06-13 20:13:35 +04:00
|
|
|
.Op Fl p Ar string
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl s Ar replstr
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl U Ar user
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl G Ar group
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Oo
|
|
|
|
.Fl T
|
|
|
|
.Op Ar from_date
|
1999-03-07 14:02:05 +03:00
|
|
|
.Sm off
|
1999-03-07 22:58:45 +03:00
|
|
|
.Oo , Ar to_date Oc
|
|
|
|
.Oo /[ Cm c ] [ Cm m ] Oc
|
1999-03-07 14:02:05 +03:00
|
|
|
.Sm on
|
1994-06-13 20:13:35 +04:00
|
|
|
.Oc
|
1999-03-07 04:07:57 +03:00
|
|
|
.Ar ...\&
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ek
|
1999-03-07 14:02:05 +03:00
|
|
|
.Bk -words
|
1999-03-07 04:07:57 +03:00
|
|
|
.Op Ar file ...\&
|
1999-03-07 14:02:05 +03:00
|
|
|
.Ek
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar directory
|
|
|
|
.Sh DESCRIPTION
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will read, write, and list the members of an archive file,
|
|
|
|
and will copy directory hierarchies.
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
operation is independent of the specific archive format,
|
|
|
|
and supports a wide variety of different archive formats.
|
|
|
|
A list of supported archive formats can be found under the description of the
|
|
|
|
.Fl x
|
|
|
|
option.
|
|
|
|
.Pp
|
|
|
|
The presence of the
|
|
|
|
.Fl r
|
|
|
|
and the
|
|
|
|
.Fl w
|
|
|
|
options specifies which of the following functional modes
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will operate under:
|
|
|
|
.Em list , read , write ,
|
|
|
|
and
|
1999-09-26 13:57:31 +04:00
|
|
|
.Em copy .
|
1994-06-13 20:13:35 +04:00
|
|
|
.Bl -tag -width 6n
|
1999-03-07 23:28:55 +03:00
|
|
|
.It Aq none
|
1994-06-13 20:13:35 +04:00
|
|
|
.Em List .
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will write to
|
|
|
|
.Dv standard output
|
|
|
|
a table of contents of the members of the archive file read from
|
|
|
|
.Dv standard input ,
|
|
|
|
whose pathnames match the specified
|
1999-09-26 13:57:31 +04:00
|
|
|
.Ar patterns .
|
1994-06-13 20:13:35 +04:00
|
|
|
The table of contents contains one filename per line
|
|
|
|
and is written using single line buffering.
|
|
|
|
.It Fl r
|
|
|
|
.Em Read .
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
extracts the members of the archive file read from the
|
|
|
|
.Dv standard input ,
|
2001-10-28 22:03:12 +03:00
|
|
|
with pathnames matching the specified
|
1999-09-26 13:57:31 +04:00
|
|
|
.Ar patterns .
|
1994-06-13 20:13:35 +04:00
|
|
|
The archive format and blocking is automatically determined on input.
|
|
|
|
When an extracted file is a directory, the entire file hierarchy
|
|
|
|
rooted at that directory is extracted.
|
|
|
|
All extracted files are created relative to the current file hierarchy.
|
|
|
|
The setting of ownership, access and modification times, and file mode of
|
|
|
|
the extracted files are discussed in more detail under the
|
|
|
|
.Fl p
|
|
|
|
option.
|
|
|
|
.It Fl w
|
|
|
|
.Em Write .
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
2001-10-28 22:03:12 +03:00
|
|
|
writes an archive containing the
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar file
|
|
|
|
operands to
|
|
|
|
.Dv standard output
|
|
|
|
using the specified archive format.
|
2001-10-28 22:03:12 +03:00
|
|
|
When no
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar file
|
2001-10-28 22:03:12 +03:00
|
|
|
operands are specified, a list of files to copy with one per line is read from
|
1994-06-13 20:13:35 +04:00
|
|
|
.Dv standard input .
|
2001-10-28 22:03:12 +03:00
|
|
|
When a
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar file
|
|
|
|
operand is also a directory, the entire file hierarchy rooted
|
|
|
|
at that directory will be included.
|
|
|
|
.It Fl r Fl w
|
|
|
|
.Em Copy .
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
copies the
|
|
|
|
.Ar file
|
|
|
|
operands to the destination
|
|
|
|
.Ar directory .
|
2001-10-28 22:03:12 +03:00
|
|
|
When no
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar file
|
|
|
|
operands are specified, a list of files to copy with one per line is read from
|
|
|
|
the
|
|
|
|
.Dv standard input .
|
|
|
|
When a
|
|
|
|
.Ar file
|
|
|
|
operand is also a directory the entire file
|
|
|
|
hierarchy rooted at that directory will be included.
|
|
|
|
The effect of the
|
|
|
|
.Em copy
|
|
|
|
is as if the copied files were written to an archive file and then
|
|
|
|
subsequently extracted, except that there may be hard links between
|
|
|
|
the original and the copied files (see the
|
|
|
|
.Fl l
|
|
|
|
option below).
|
|
|
|
.Pp
|
|
|
|
.Em Warning :
|
|
|
|
The destination
|
|
|
|
.Ar directory
|
|
|
|
must not be one of the
|
|
|
|
.Ar file
|
|
|
|
operands or a member of a file hierarchy rooted at one of the
|
|
|
|
.Ar file
|
|
|
|
operands.
|
|
|
|
The result of a
|
|
|
|
.Em copy
|
|
|
|
under these conditions is unpredictable.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
While processing a damaged archive during a
|
|
|
|
.Em read
|
|
|
|
or
|
|
|
|
.Em list
|
|
|
|
operation,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will attempt to recover from media defects and will search through the archive
|
|
|
|
to locate and process the largest number of archive members possible (see the
|
|
|
|
.Fl E
|
|
|
|
option for more details on error handling).
|
|
|
|
.Sh OPERANDS
|
|
|
|
The
|
|
|
|
.Ar directory
|
|
|
|
operand specifies a destination directory pathname.
|
|
|
|
If the
|
|
|
|
.Ar directory
|
|
|
|
operand does not exist, or it is not writable by the user,
|
|
|
|
or it is not of type directory,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will exit with a non-zero exit status.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Ar pattern
|
|
|
|
operand is used to select one or more pathnames of archive members.
|
|
|
|
Archive members are selected using the pattern matching notation described
|
|
|
|
by
|
|
|
|
.Xr fnmatch 3 .
|
2001-10-28 22:03:12 +03:00
|
|
|
When the
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar pattern
|
|
|
|
operand is not supplied, all members of the archive will be selected.
|
2001-10-28 22:03:12 +03:00
|
|
|
When a
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar pattern
|
|
|
|
matches a directory, the entire file hierarchy rooted at that directory will
|
|
|
|
be selected.
|
|
|
|
When a
|
|
|
|
.Ar pattern
|
|
|
|
operand does not select at least one archive member,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will write these
|
|
|
|
.Ar pattern
|
|
|
|
operands in a diagnostic message to
|
|
|
|
.Dv standard error
|
|
|
|
and then exit with a non-zero exit status.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Ar file
|
|
|
|
operand specifies the pathname of a file to be copied or archived.
|
|
|
|
When a
|
|
|
|
.Ar file
|
|
|
|
operand does not select at least one archive member,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will write these
|
|
|
|
.Ar file
|
|
|
|
operand pathnames in a diagnostic message to
|
|
|
|
.Dv standard error
|
|
|
|
and then exit with a non-zero exit status.
|
|
|
|
.Sh OPTIONS
|
|
|
|
The following options are supported:
|
|
|
|
.Bl -tag -width 4n
|
|
|
|
.It Fl r
|
|
|
|
Read an archive file from
|
|
|
|
.Dv standard input
|
|
|
|
and extract the specified
|
|
|
|
.Ar files .
|
|
|
|
If any intermediate directories are needed in order to extract an archive
|
|
|
|
member, these directories will be created as if
|
|
|
|
.Xr mkdir 2
|
|
|
|
was called with the bitwise inclusive
|
2001-10-28 22:03:12 +03:00
|
|
|
.Dv OR
|
1994-06-13 20:13:35 +04:00
|
|
|
of
|
|
|
|
.Dv S_IRWXU , S_IRWXG ,
|
|
|
|
and
|
2001-10-28 22:03:12 +03:00
|
|
|
.Dv S_IRWXO
|
1994-06-13 20:13:35 +04:00
|
|
|
as the mode argument.
|
|
|
|
When the selected archive format supports the specification of linked
|
|
|
|
files and these files cannot be linked while the archive is being extracted,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will write a diagnostic message to
|
|
|
|
.Dv standard error
|
|
|
|
and exit with a non-zero exit status at the completion of operation.
|
|
|
|
.It Fl w
|
|
|
|
Write files to the
|
|
|
|
.Dv standard output
|
|
|
|
in the specified archive format.
|
|
|
|
When no
|
|
|
|
.Ar file
|
|
|
|
operands are specified,
|
|
|
|
.Dv standard input
|
|
|
|
is read for a list of pathnames with one per line without any leading or
|
|
|
|
trailing
|
|
|
|
.Aq blanks .
|
|
|
|
.It Fl a
|
|
|
|
Append
|
|
|
|
.Ar files
|
|
|
|
to the end of an archive that was previously written.
|
|
|
|
If an archive format is not specified with a
|
|
|
|
.Fl x
|
|
|
|
option, the format currently being used in the archive will be selected.
|
|
|
|
Any attempt to append to an archive in a format different from the
|
2001-10-28 22:03:12 +03:00
|
|
|
format already used in the archive will cause
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
to exit immediately
|
|
|
|
with a non-zero exit status.
|
|
|
|
The blocking size used in the archive volume where writing starts
|
|
|
|
will continue to be used for the remainder of that archive volume.
|
|
|
|
.Pp
|
|
|
|
.Em Warning :
|
|
|
|
Many storage devices are not able to support the operations necessary
|
|
|
|
to perform an append operation.
|
|
|
|
Any attempt to append to an archive stored on such a device may damage the
|
|
|
|
archive or have other unpredictable results.
|
|
|
|
Tape drives in particular are more likely to not support an append operation.
|
|
|
|
An archive stored in a regular file system file or on a disk device will
|
|
|
|
usually support an append operation.
|
|
|
|
.It Fl b Ar blocksize
|
|
|
|
When
|
|
|
|
.Em writing
|
|
|
|
an archive,
|
|
|
|
block the output at a positive decimal integer number of
|
|
|
|
bytes per write to the archive file.
|
|
|
|
The
|
|
|
|
.Ar blocksize
|
|
|
|
must be a multiple of 512 bytes with a maximum of 32256 bytes.
|
|
|
|
A
|
|
|
|
.Ar blocksize
|
|
|
|
can end with
|
|
|
|
.Li k
|
|
|
|
or
|
|
|
|
.Li b
|
|
|
|
to specify multiplication by 1024 (1K) or 512, respectively.
|
|
|
|
A pair of
|
|
|
|
.Ar blocksizes
|
|
|
|
can be separated by
|
|
|
|
.Li x
|
|
|
|
to indicate a product.
|
|
|
|
A specific archive device may impose additional restrictions on the size
|
|
|
|
of blocking it will support.
|
2001-10-28 22:03:12 +03:00
|
|
|
When blocking is not specified, the default
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar blocksize
|
|
|
|
is dependent on the specific archive format being used (see the
|
|
|
|
.Fl x
|
|
|
|
option).
|
|
|
|
.It Fl c
|
|
|
|
Match all file or archive members
|
|
|
|
.Em except
|
|
|
|
those specified by the
|
|
|
|
.Ar pattern
|
|
|
|
and
|
|
|
|
.Ar file
|
|
|
|
operands.
|
|
|
|
.It Fl d
|
|
|
|
Cause files of type directory being copied or archived, or archive members of
|
|
|
|
type directory being extracted, to match only the directory file or archive
|
|
|
|
member and not the file hierarchy rooted at the directory.
|
|
|
|
.It Fl f Ar archive
|
|
|
|
Specify
|
|
|
|
.Ar archive
|
|
|
|
as the pathname of the input or output archive, overriding the default
|
|
|
|
.Dv standard input
|
|
|
|
(for
|
|
|
|
.Em list
|
|
|
|
and
|
|
|
|
.Em read )
|
|
|
|
or
|
|
|
|
.Dv standard output
|
|
|
|
(for
|
|
|
|
.Em write ) .
|
|
|
|
A single archive may span multiple files and different archive devices.
|
|
|
|
When required,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will prompt for the pathname of the file or device of the next volume in the
|
|
|
|
archive.
|
|
|
|
.It Fl i
|
|
|
|
Interactively rename files or archive members.
|
|
|
|
For each archive member matching a
|
|
|
|
.Ar pattern
|
|
|
|
operand or each file matching a
|
|
|
|
.Ar file
|
|
|
|
operand,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will prompt to
|
|
|
|
.Pa /dev/tty
|
|
|
|
giving the name of the file, its file mode and its modification time.
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will then read a line from
|
|
|
|
.Pa /dev/tty .
|
|
|
|
If this line is blank, the file or archive member is skipped.
|
|
|
|
If this line consists of a single period, the
|
|
|
|
file or archive member is processed with no modification to its name.
|
|
|
|
Otherwise, its name is replaced with the contents of the line.
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
2001-10-28 22:03:12 +03:00
|
|
|
will immediately exit with a non-zero exit status if
|
|
|
|
.Aq Dv EOF
|
1994-06-13 20:13:35 +04:00
|
|
|
is encountered when reading a response or if
|
|
|
|
.Pa /dev/tty
|
|
|
|
cannot be opened for reading and writing.
|
|
|
|
.It Fl k
|
|
|
|
Do not overwrite existing files.
|
|
|
|
.It Fl l
|
|
|
|
Link files. (The letter ell).
|
|
|
|
In the
|
|
|
|
.Em copy
|
1999-03-07 23:28:55 +03:00
|
|
|
mode
|
1999-03-08 01:40:18 +03:00
|
|
|
.Fl ( r
|
|
|
|
.Fl w ) ,
|
1994-06-13 20:13:35 +04:00
|
|
|
hard links are made between the source and destination file hierarchies
|
|
|
|
whenever possible.
|
|
|
|
.It Fl n
|
|
|
|
Select the first archive member that matches each
|
|
|
|
.Ar pattern
|
|
|
|
operand.
|
|
|
|
No more than one archive member is matched for each
|
|
|
|
.Ar pattern .
|
|
|
|
When members of type directory are matched, the file hierarchy rooted at that
|
|
|
|
directory is also matched (unless
|
2001-10-28 22:03:12 +03:00
|
|
|
.Fl d
|
1994-06-13 20:13:35 +04:00
|
|
|
is also specified).
|
|
|
|
.It Fl o Ar options
|
|
|
|
Information to modify the algorithm for extracting or writing archive files
|
|
|
|
which is specific to the archive format specified by
|
|
|
|
.Fl x .
|
|
|
|
In general,
|
|
|
|
.Ar options
|
|
|
|
take the form:
|
|
|
|
.Cm name=value
|
|
|
|
.It Fl p Ar string
|
|
|
|
Specify one or more file characteristic options (privileges).
|
|
|
|
The
|
|
|
|
.Ar string
|
|
|
|
option-argument is a string specifying file characteristics to be retained or
|
|
|
|
discarded on extraction.
|
|
|
|
The string consists of the specification characters
|
2000-08-21 17:53:50 +04:00
|
|
|
.Cm a , e , f ,
|
|
|
|
.Cm m , o ,
|
1994-06-13 20:13:35 +04:00
|
|
|
and
|
|
|
|
.Cm p .
|
|
|
|
Multiple characteristics can be concatenated within the same string
|
|
|
|
and multiple
|
2001-10-28 22:03:12 +03:00
|
|
|
.Fl p
|
1994-06-13 20:13:35 +04:00
|
|
|
options can be specified.
|
|
|
|
The meaning of the specification characters are as follows:
|
|
|
|
.Bl -tag -width 2n
|
|
|
|
.It Cm a
|
|
|
|
Do not preserve file access times.
|
|
|
|
By default, file access times are preserved whenever possible.
|
|
|
|
.It Cm e
|
|
|
|
.Sq Preserve everything ,
|
|
|
|
the user ID, group ID, file mode bits,
|
|
|
|
file access time, and file modification time.
|
|
|
|
This is intended to be used by
|
|
|
|
.Em root ,
|
|
|
|
someone with all the appropriate privileges, in order to preserve all
|
|
|
|
aspects of the files as they are recorded in the archive.
|
2001-10-28 22:03:12 +03:00
|
|
|
The
|
1994-06-13 20:13:35 +04:00
|
|
|
.Cm e
|
|
|
|
flag is the sum of the
|
2001-10-28 22:03:12 +03:00
|
|
|
.Cm o
|
1994-06-13 20:13:35 +04:00
|
|
|
and
|
|
|
|
.Cm p
|
|
|
|
flags.
|
1999-11-07 18:57:31 +03:00
|
|
|
.\" .It Cm f
|
|
|
|
.\" Do not preserve file flags.
|
|
|
|
.\" By default, file flags are preserved whenever possible.
|
1994-06-13 20:13:35 +04:00
|
|
|
.It Cm m
|
|
|
|
Do not preserve file modification times.
|
|
|
|
By default, file modification times are preserved whenever possible.
|
|
|
|
.It Cm o
|
|
|
|
Preserve the user ID and group ID.
|
|
|
|
.It Cm p
|
|
|
|
.Sq Preserve
|
|
|
|
the file mode bits.
|
|
|
|
This intended to be used by a
|
2001-10-28 22:03:12 +03:00
|
|
|
.Em user
|
1994-06-13 20:13:35 +04:00
|
|
|
with regular privileges who wants to preserve all aspects of the file other
|
|
|
|
than the ownership.
|
|
|
|
The file times are preserved by default, but two other flags are offered to
|
|
|
|
disable this and use the time of extraction instead.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
In the preceding list,
|
|
|
|
.Sq preserve
|
|
|
|
indicates that an attribute stored in the archive is given to the
|
|
|
|
extracted file, subject to the permissions of the invoking
|
|
|
|
process.
|
|
|
|
Otherwise the attribute of the extracted file is determined as
|
|
|
|
part of the normal file creation action.
|
2001-10-28 22:03:12 +03:00
|
|
|
If neither the
|
1994-06-13 20:13:35 +04:00
|
|
|
.Cm e
|
|
|
|
nor the
|
|
|
|
.Cm o
|
|
|
|
specification character is specified, or the user ID and group ID are not
|
|
|
|
preserved for any reason,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will not set the
|
2001-10-28 22:03:12 +03:00
|
|
|
.Dv S_ISUID
|
1994-06-13 20:13:35 +04:00
|
|
|
.Em ( setuid )
|
|
|
|
and
|
|
|
|
.Dv S_ISGID
|
|
|
|
.Em ( setgid )
|
|
|
|
bits of the file mode.
|
|
|
|
If the preservation of any of these items fails for any reason,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will write a diagnostic message to
|
|
|
|
.Dv standard error .
|
|
|
|
Failure to preserve these items will affect the final exit status,
|
|
|
|
but will not cause the extracted file to be deleted.
|
|
|
|
If the file characteristic letters in any of the string option-arguments are
|
|
|
|
duplicated or conflict with each other, the one(s) given last will take
|
|
|
|
precedence.
|
|
|
|
For example, if
|
|
|
|
.Dl Fl p Ar eme
|
|
|
|
is specified, file modification times are still preserved.
|
|
|
|
.It Fl s Ar replstr
|
|
|
|
Modify the file or archive member names specified by the
|
|
|
|
.Ar pattern
|
|
|
|
or
|
|
|
|
.Ar file
|
|
|
|
operands according to the substitution expression
|
|
|
|
.Ar replstr ,
|
|
|
|
using the syntax of the
|
|
|
|
.Xr ed 1
|
|
|
|
utility regular expressions.
|
|
|
|
The format of these regular expressions are:
|
|
|
|
.Dl /old/new/[gp]
|
|
|
|
As in
|
|
|
|
.Xr ed 1 ,
|
|
|
|
.Cm old
|
|
|
|
is a basic regular expression and
|
|
|
|
.Cm new
|
2002-02-08 04:21:55 +03:00
|
|
|
can contain an ampersand (\*[Am]), \\n (where n is a digit) back-references,
|
1994-06-13 20:13:35 +04:00
|
|
|
or subexpression matching.
|
|
|
|
The
|
|
|
|
.Cm old
|
|
|
|
string may also contain
|
2001-10-28 22:03:12 +03:00
|
|
|
.Aq Dv newline
|
1994-06-13 20:13:35 +04:00
|
|
|
characters.
|
|
|
|
Any non-null character can be used as a delimiter (/ is shown here).
|
|
|
|
Multiple
|
|
|
|
.Fl s
|
|
|
|
expressions can be specified.
|
|
|
|
The expressions are applied in the order they are specified on the
|
|
|
|
command line, terminating with the first successful substitution.
|
|
|
|
The optional trailing
|
|
|
|
.Cm g
|
|
|
|
continues to apply the substitution expression to the pathname substring
|
|
|
|
which starts with the first character following the end of the last successful
|
|
|
|
substitution. The first unsuccessful substitution stops the operation of the
|
|
|
|
.Cm g
|
|
|
|
option.
|
|
|
|
The optional trailing
|
|
|
|
.Cm p
|
|
|
|
will cause the final result of a successful substitution to be written to
|
|
|
|
.Dv standard error
|
|
|
|
in the following format:
|
2002-02-08 04:21:55 +03:00
|
|
|
.Dl Ao "original pathname" Ac \*[Gt]\*[Gt] Ao "new pathname" Ac
|
1994-06-13 20:13:35 +04:00
|
|
|
File or archive member names that substitute to the empty string
|
|
|
|
are not selected and will be skipped.
|
|
|
|
.It Fl t
|
|
|
|
Reset the access times of any file or directory read or accessed by
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
to be the same as they were before being read or accessed by
|
2000-09-04 11:26:38 +04:00
|
|
|
.Nm "" ,
|
|
|
|
if the user has the appropriate permissions required by
|
|
|
|
.Xr utime 3 .
|
1994-06-13 20:13:35 +04:00
|
|
|
.It Fl u
|
|
|
|
Ignore files that are older (having a less recent file modification time)
|
|
|
|
than a pre-existing file or archive member with the same name.
|
|
|
|
During
|
|
|
|
.Em read ,
|
|
|
|
an archive member with the same name as a file in the file system will be
|
|
|
|
extracted if the archive member is newer than the file.
|
|
|
|
During
|
|
|
|
.Em write ,
|
|
|
|
a file system member with the same name as an archive member will be
|
|
|
|
written to the archive if it is newer than the archive member.
|
|
|
|
During
|
|
|
|
.Em copy ,
|
|
|
|
the file in the destination hierarchy is replaced by the file in the source
|
|
|
|
hierarchy or by a link to the file in the source hierarchy if the file in
|
|
|
|
the source hierarchy is newer.
|
|
|
|
.It Fl v
|
|
|
|
During a
|
|
|
|
.Em list
|
|
|
|
operation, produce a verbose table of contents using the format of the
|
|
|
|
.Xr ls 1
|
|
|
|
utility with the
|
|
|
|
.Fl l
|
|
|
|
option.
|
|
|
|
For pathnames representing a hard link to a previous member of the archive,
|
|
|
|
the output has the format:
|
1999-03-07 23:28:55 +03:00
|
|
|
.Dl Ao "ls -l listing" Ac == Ao "link name" Ac
|
1994-06-13 20:13:35 +04:00
|
|
|
For pathnames representing a symbolic link, the output has the format:
|
2002-02-08 04:21:55 +03:00
|
|
|
.Dl Ao "ls -l listing" Ac =\*[Gt] Ao "link name" Ac
|
1999-03-07 23:28:55 +03:00
|
|
|
Where
|
|
|
|
.Aq "ls -l listing"
|
2001-10-28 22:03:12 +03:00
|
|
|
is the output format specified by the
|
1994-06-13 20:13:35 +04:00
|
|
|
.Xr ls 1
|
|
|
|
utility when used with the
|
|
|
|
.Fl l
|
|
|
|
option.
|
1999-03-07 23:28:55 +03:00
|
|
|
Otherwise for all the other operational modes
|
1999-03-08 01:40:18 +03:00
|
|
|
.Em ( read , write ,
|
1994-06-13 20:13:35 +04:00
|
|
|
and
|
1999-03-08 01:40:18 +03:00
|
|
|
.Em copy ) ,
|
1994-06-13 20:13:35 +04:00
|
|
|
pathnames are written and flushed to
|
|
|
|
.Dv standard error
|
|
|
|
without a trailing
|
2001-10-28 22:03:12 +03:00
|
|
|
.Aq Dv newline
|
1994-06-13 20:13:35 +04:00
|
|
|
as soon as processing begins on that file or
|
|
|
|
archive member.
|
|
|
|
The trailing
|
2001-10-28 22:03:12 +03:00
|
|
|
.Aq Dv newline ,
|
1994-06-13 20:13:35 +04:00
|
|
|
is not buffered, and is written only after the file has been read or written.
|
|
|
|
.It Fl x Ar format
|
|
|
|
Specify the output archive format, with the default format being
|
|
|
|
.Ar ustar .
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
currently supports the following formats:
|
|
|
|
.Bl -tag -width "sv4cpio"
|
|
|
|
.It Ar cpio
|
|
|
|
The extended cpio interchange format specified in the
|
|
|
|
.St -p1003.2
|
|
|
|
standard.
|
|
|
|
The default blocksize for this format is 5120 bytes.
|
|
|
|
Inode and device information about a file (used for detecting file hard links
|
|
|
|
by this format) which may be truncated by this format is detected by
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
and is repaired.
|
|
|
|
.It Ar bcpio
|
|
|
|
The old binary cpio format.
|
|
|
|
The default blocksize for this format is 5120 bytes.
|
|
|
|
This format is not very portable and should not be used when other formats
|
|
|
|
are available.
|
|
|
|
Inode and device information about a file (used for detecting file hard links
|
|
|
|
by this format) which may be truncated by this format is detected by
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
and is repaired.
|
|
|
|
.It Ar sv4cpio
|
1998-02-06 08:39:31 +03:00
|
|
|
The
|
|
|
|
.At V.4
|
|
|
|
cpio.
|
1994-06-13 20:13:35 +04:00
|
|
|
The default blocksize for this format is 5120 bytes.
|
|
|
|
Inode and device information about a file (used for detecting file hard links
|
|
|
|
by this format) which may be truncated by this format is detected by
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
and is repaired.
|
|
|
|
.It Ar sv4crc
|
1998-02-06 08:39:31 +03:00
|
|
|
The
|
|
|
|
.At V.4
|
|
|
|
cpio with file crc checksums.
|
1994-06-13 20:13:35 +04:00
|
|
|
The default blocksize for this format is 5120 bytes.
|
|
|
|
Inode and device information about a file (used for detecting file hard links
|
|
|
|
by this format) which may be truncated by this format is detected by
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
and is repaired.
|
|
|
|
.It Ar tar
|
1998-02-06 08:39:31 +03:00
|
|
|
The old
|
|
|
|
.Bx
|
2001-10-28 22:03:12 +03:00
|
|
|
tar format as found in
|
1998-02-06 08:39:31 +03:00
|
|
|
.Bx 4.3 .
|
1994-06-13 20:13:35 +04:00
|
|
|
The default blocksize for this format is 10240 bytes.
|
|
|
|
Pathnames stored by this format must be 100 characters or less in length.
|
|
|
|
Only
|
|
|
|
.Em regular
|
|
|
|
files,
|
|
|
|
.Em hard links , soft links ,
|
|
|
|
and
|
|
|
|
.Em directories
|
|
|
|
will be archived (other file system types are not supported).
|
|
|
|
For backwards compatibility with even older tar formats, a
|
|
|
|
.Fl o
|
|
|
|
option can be used when writing an archive to omit the storage of directories.
|
|
|
|
This option takes the form:
|
|
|
|
.Dl Fl o Cm write_opt=nodir
|
|
|
|
.It Ar ustar
|
|
|
|
The extended tar interchange format specified in the
|
|
|
|
.St -p1003.2
|
|
|
|
standard.
|
|
|
|
The default blocksize for this format is 10240 bytes.
|
|
|
|
Pathnames stored by this format must be 250 characters or less in length.
|
|
|
|
.El
|
|
|
|
.Pp
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will detect and report any file that it is unable to store or extract
|
|
|
|
as the result of any specific archive format restrictions.
|
|
|
|
The individual archive formats may impose additional restrictions on use.
|
|
|
|
Typical archive format restrictions include (but are not limited to):
|
|
|
|
file pathname length, file size, link pathname length and the type of the file.
|
1998-03-02 07:50:57 +03:00
|
|
|
.It Fl z
|
|
|
|
Use
|
|
|
|
.Xr gzip 1
|
|
|
|
compression, when reading or writing archive files.
|
1999-08-24 11:57:06 +04:00
|
|
|
.It Fl A
|
|
|
|
Do not strip leading `/'s from file names.
|
1994-06-13 20:13:35 +04:00
|
|
|
.It Fl B Ar bytes
|
|
|
|
Limit the number of bytes written to a single archive volume to
|
|
|
|
.Ar bytes .
|
|
|
|
The
|
|
|
|
.Ar bytes
|
|
|
|
limit can end with
|
|
|
|
.Li m ,
|
|
|
|
.Li k ,
|
|
|
|
or
|
|
|
|
.Li b
|
|
|
|
to specify multiplication by 1048576 (1M), 1024 (1K) or 512, respectively.
|
|
|
|
A pair of
|
|
|
|
.Ar bytes
|
|
|
|
limits can be separated by
|
|
|
|
.Li x
|
|
|
|
to indicate a product.
|
|
|
|
.Pp
|
|
|
|
.Em Warning :
|
|
|
|
Only use this option when writing an archive to a device which supports
|
|
|
|
an end of file read condition based on last (or largest) write offset
|
2001-10-28 22:03:12 +03:00
|
|
|
(such as a regular file or a tape drive).
|
1994-06-13 20:13:35 +04:00
|
|
|
The use of this option with a floppy or hard disk is not recommended.
|
|
|
|
.It Fl D
|
|
|
|
This option is the same as the
|
|
|
|
.Fl u
|
|
|
|
option, except that the file inode change time is checked instead of the
|
|
|
|
file modification time.
|
|
|
|
The file inode change time can be used to select files whose inode information
|
|
|
|
(e.g. uid, gid, etc.) is newer than a copy of the file in the destination
|
|
|
|
.Ar directory .
|
|
|
|
.It Fl E Ar limit
|
|
|
|
Limit the number of consecutive read faults while trying to read a flawed
|
|
|
|
archives to
|
|
|
|
.Ar limit .
|
|
|
|
With a positive
|
|
|
|
.Ar limit ,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will attempt to recover from an archive read error and will
|
|
|
|
continue processing starting with the next file stored in the archive.
|
|
|
|
A
|
|
|
|
.Ar limit
|
|
|
|
of 0 will cause
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
to stop operation after the first read error is detected on an archive volume.
|
|
|
|
A
|
|
|
|
.Ar limit
|
|
|
|
of
|
|
|
|
.Li NONE
|
|
|
|
will cause
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
to attempt to recover from read errors forever.
|
2001-10-28 22:03:12 +03:00
|
|
|
The default
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar limit
|
|
|
|
is a small positive number of retries.
|
|
|
|
.Pp
|
2001-10-28 22:03:12 +03:00
|
|
|
.Em Warning :
|
1994-06-13 20:13:35 +04:00
|
|
|
Using this option with
|
|
|
|
.Li NONE
|
|
|
|
should be used with extreme caution as
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
may get stuck in an infinite loop on a very badly flawed archive.
|
|
|
|
.It Fl G Ar group
|
|
|
|
Select a file based on its
|
|
|
|
.Ar group
|
|
|
|
name, or when starting with a
|
|
|
|
.Cm # ,
|
|
|
|
a numeric gid.
|
|
|
|
A '\\' can be used to escape the
|
|
|
|
.Cm # .
|
2001-10-28 22:03:12 +03:00
|
|
|
Multiple
|
1994-06-13 20:13:35 +04:00
|
|
|
.Fl G
|
|
|
|
options may be supplied and checking stops with the first match.
|
|
|
|
.It Fl H
|
|
|
|
Follow only command line symbolic links while performing a physical file
|
|
|
|
system traversal.
|
|
|
|
.It Fl L
|
|
|
|
Follow all symbolic links to perform a logical file system traversal.
|
Implement -M flag: During a write or copy operation, treat the list of
files on standard input as an mtree(8) `specfile' specification, and
write or copy only those items in the specfile.
If the file exists in the underlying file system, its permissions and
modification time will be used unless specifically overridden by the
specfile. An error will be raised if the type of entry in the specfile
conflicts with that of an existing file.
Otherwise, it is necessary to specify at least the following parameters
in the specfile: type, mode, gname or gid, and uname or uid, device
(in the case of block or character devices), and link (in the case of
symbolic links). If time isn't provided, the current time will be used.
2001-10-25 12:51:50 +04:00
|
|
|
.It Fl M
|
|
|
|
During a
|
|
|
|
.Em write
|
|
|
|
or
|
|
|
|
.Em copy
|
|
|
|
operation, treat the list of files on
|
|
|
|
.Dv standard input
|
|
|
|
as an
|
|
|
|
.Xr mtree 8
|
|
|
|
.Sq specfile
|
|
|
|
specification, and write or copy only those items in the specfile.
|
|
|
|
.Pp
|
|
|
|
If the file exists in the underlying file system, its permissions and
|
|
|
|
modification time will be used unless specifically overridden by the specfile.
|
|
|
|
An error will be raised if the type of entry in the specfile conflicts
|
|
|
|
with that of an existing file.
|
|
|
|
.Pp
|
|
|
|
Otherwise, it is necessary to specify at least the following parameters
|
|
|
|
in the specfile:
|
|
|
|
.Sy type ,
|
|
|
|
.Sy mode ,
|
|
|
|
.Sy gname
|
|
|
|
or
|
|
|
|
.Sy gid ,
|
|
|
|
and
|
|
|
|
.Sy uname
|
|
|
|
or
|
|
|
|
.Sy uid ,
|
|
|
|
.Sy device
|
|
|
|
(in the case of block or character devices), and
|
|
|
|
.Sy link
|
|
|
|
(in the case of symbolic links).
|
|
|
|
If
|
|
|
|
.Sy time
|
|
|
|
isn't provided, the current time will be used.
|
2002-01-24 10:45:33 +03:00
|
|
|
.It Fl N Ar dbdir
|
|
|
|
Except for lookups for the
|
|
|
|
.Fl G
|
|
|
|
and
|
|
|
|
.Fl U
|
|
|
|
options,
|
|
|
|
use the user database text file
|
|
|
|
.Pa master.passwd
|
|
|
|
and group database text file
|
|
|
|
.Pa group
|
|
|
|
from
|
|
|
|
.Ar dbdir ,
|
|
|
|
rather than using the results from the system's
|
|
|
|
.Xr getpwnam 3
|
|
|
|
and
|
|
|
|
.Xr getgrnam 3
|
|
|
|
(and related) library calls.
|
2000-03-30 21:53:04 +04:00
|
|
|
.It Fl O
|
|
|
|
Force the archive to be one volume. If a volume ends prematurely,
|
|
|
|
.Nm
|
|
|
|
will not prompt for a new volume. This option can be useful for
|
|
|
|
automated tasks where error recovery cannot be performed by a human.
|
1994-06-13 20:13:35 +04:00
|
|
|
.It Fl P
|
|
|
|
Do not follow symbolic links, perform a physical file system traversal.
|
|
|
|
This is the default mode.
|
|
|
|
.It Fl T Ar [from_date][,to_date][/[c][m]]
|
|
|
|
Allow files to be selected based on a file modification or inode change
|
2001-10-28 22:03:12 +03:00
|
|
|
time falling within a specified time range of
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar from_date
|
|
|
|
to
|
|
|
|
.Ar to_date
|
|
|
|
(the dates are inclusive).
|
2001-10-28 22:03:12 +03:00
|
|
|
If only a
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar from_date
|
|
|
|
is supplied, all files with a modification or inode change time
|
|
|
|
equal to or younger are selected.
|
|
|
|
If only a
|
|
|
|
.Ar to_date
|
|
|
|
is supplied, all files with a modification or inode change time
|
|
|
|
equal to or older will be selected.
|
2001-10-28 22:03:12 +03:00
|
|
|
When the
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar from_date
|
|
|
|
is equal to the
|
|
|
|
.Ar to_date ,
|
|
|
|
only files with a modification or inode change time of exactly that
|
|
|
|
time will be selected.
|
|
|
|
.Pp
|
|
|
|
When
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
2001-10-28 22:03:12 +03:00
|
|
|
is in the
|
1994-06-13 20:13:35 +04:00
|
|
|
.Em write
|
|
|
|
or
|
|
|
|
.Em copy
|
|
|
|
mode, the optional trailing field
|
|
|
|
.Ar [c][m]
|
|
|
|
can be used to determine which file time (inode change, file modification or
|
|
|
|
both) are used in the comparison.
|
|
|
|
If neither is specified, the default is to use file modification time only.
|
|
|
|
The
|
|
|
|
.Ar m
|
|
|
|
specifies the comparison of file modification time (the time when
|
|
|
|
the file was last written).
|
|
|
|
The
|
|
|
|
.Ar c
|
|
|
|
specifies the comparison of inode change time (the time when the file
|
|
|
|
inode was last changed; e.g. a change of owner, group, mode, etc).
|
2001-10-28 22:03:12 +03:00
|
|
|
When
|
1994-06-13 20:13:35 +04:00
|
|
|
.Ar c
|
|
|
|
and
|
|
|
|
.Ar m
|
|
|
|
are both specified, then the modification and inode change times are
|
|
|
|
both compared.
|
|
|
|
The inode change time comparison is useful in selecting files whose
|
|
|
|
attributes were recently changed or selecting files which were recently
|
|
|
|
created and had their modification time reset to an older time (as what
|
|
|
|
happens when a file is extracted from an archive and the modification time
|
|
|
|
is preserved).
|
|
|
|
Time comparisons using both file times is useful when
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
is used to create a time based incremental archive (only files that were
|
|
|
|
changed during a specified time range will be archived).
|
|
|
|
.Pp
|
|
|
|
A time range is made up of six different fields and each field must contain two
|
|
|
|
digits.
|
|
|
|
The format is:
|
1998-01-21 03:11:15 +03:00
|
|
|
.Dl [[[[[cc]yy]mm]dd]hh]mm[\&.ss]
|
1994-06-13 20:13:35 +04:00
|
|
|
Where
|
1998-01-21 03:11:15 +03:00
|
|
|
.Cm cc
|
|
|
|
is the first two digits of the year (the century),
|
1994-06-13 20:13:35 +04:00
|
|
|
.Cm yy
|
|
|
|
is the last two digits of the year,
|
|
|
|
the first
|
|
|
|
.Cm mm
|
|
|
|
is the month (from 01 to 12),
|
|
|
|
.Cm dd
|
|
|
|
is the day of the month (from 01 to 31),
|
|
|
|
.Cm hh
|
|
|
|
is the hour of the day (from 00 to 23),
|
|
|
|
the second
|
|
|
|
.Cm mm
|
|
|
|
is the minute (from 00 to 59),
|
|
|
|
and
|
|
|
|
.Cm ss
|
1998-01-21 03:11:15 +03:00
|
|
|
is the seconds (from 00 to 61).
|
|
|
|
Only the minute field
|
1994-06-13 20:13:35 +04:00
|
|
|
.Cm mm
|
1998-01-21 03:11:15 +03:00
|
|
|
is required; the others will default to the current system values.
|
2001-10-28 22:03:12 +03:00
|
|
|
The
|
1994-06-13 20:13:35 +04:00
|
|
|
.Cm ss
|
|
|
|
field may be added independently of the other fields.
|
1998-01-21 03:11:15 +03:00
|
|
|
If the century is not specified, it defaults to 1900 for
|
|
|
|
years between 69 and 99, or 2000 for years between 0 and 68.
|
1994-06-13 20:13:35 +04:00
|
|
|
Time ranges are relative to the current time, so
|
|
|
|
.Dl Fl T Ar 1234/cm
|
|
|
|
would select all files with a modification or inode change time
|
|
|
|
of 12:34 PM today or later.
|
2001-10-28 22:03:12 +03:00
|
|
|
Multiple
|
1994-06-13 20:13:35 +04:00
|
|
|
.Fl T
|
|
|
|
time range can be supplied and checking stops with the first match.
|
|
|
|
.It Fl U Ar user
|
|
|
|
Select a file based on its
|
|
|
|
.Ar user
|
|
|
|
name, or when starting with a
|
|
|
|
.Cm # ,
|
|
|
|
a numeric uid.
|
|
|
|
A '\\' can be used to escape the
|
|
|
|
.Cm # .
|
2001-10-28 22:03:12 +03:00
|
|
|
Multiple
|
1994-06-13 20:13:35 +04:00
|
|
|
.Fl U
|
|
|
|
options may be supplied and checking stops with the first match.
|
|
|
|
.It Fl X
|
|
|
|
When traversing the file hierarchy specified by a pathname,
|
|
|
|
do not descend into directories that have a different device ID.
|
|
|
|
See the
|
2001-10-28 22:03:12 +03:00
|
|
|
.Li st_dev
|
1994-06-13 20:13:35 +04:00
|
|
|
field as described in
|
|
|
|
.Xr stat 2
|
|
|
|
for more information about device ID's.
|
|
|
|
.It Fl Y
|
|
|
|
This option is the same as the
|
|
|
|
.Fl D
|
|
|
|
option, except that the inode change time is checked using the
|
|
|
|
pathname created after all the file name modifications have completed.
|
|
|
|
.It Fl Z
|
|
|
|
This option is the same as the
|
|
|
|
.Fl u
|
|
|
|
option, except that the modification time is checked using the
|
|
|
|
pathname created after all the file name modifications have completed.
|
|
|
|
.El
|
|
|
|
.Pp
|
1999-03-07 23:28:55 +03:00
|
|
|
The options that operate on the names of files or archive members
|
1999-03-08 01:40:18 +03:00
|
|
|
.Fl ( c ,
|
1994-06-13 20:13:35 +04:00
|
|
|
.Fl i ,
|
|
|
|
.Fl n ,
|
|
|
|
.Fl s ,
|
|
|
|
.Fl u ,
|
|
|
|
.Fl v ,
|
|
|
|
.Fl D ,
|
|
|
|
.Fl G ,
|
|
|
|
.Fl T ,
|
|
|
|
.Fl U ,
|
|
|
|
.Fl Y ,
|
|
|
|
and
|
1999-03-08 01:40:18 +03:00
|
|
|
.Fl Z )
|
1994-06-13 20:13:35 +04:00
|
|
|
interact as follows.
|
|
|
|
.Pp
|
|
|
|
When extracting files during a
|
|
|
|
.Em read
|
|
|
|
operation, archive members are
|
|
|
|
.Sq selected ,
|
|
|
|
based only on the user specified pattern operands as modified by the
|
|
|
|
.Fl c ,
|
|
|
|
.Fl n ,
|
|
|
|
.Fl u ,
|
|
|
|
.Fl D ,
|
|
|
|
.Fl G ,
|
|
|
|
.Fl T ,
|
|
|
|
.Fl U
|
|
|
|
options.
|
|
|
|
Then any
|
|
|
|
.Fl s
|
|
|
|
and
|
|
|
|
.Fl i
|
|
|
|
options will modify in that order, the names of these selected files.
|
|
|
|
Then the
|
|
|
|
.Fl Y
|
|
|
|
and
|
|
|
|
.Fl Z
|
|
|
|
options will be applied based on the final pathname.
|
2001-10-28 22:03:12 +03:00
|
|
|
Finally the
|
1994-06-13 20:13:35 +04:00
|
|
|
.Fl v
|
|
|
|
option will write the names resulting from these modifications.
|
|
|
|
.Pp
|
|
|
|
When archiving files during a
|
|
|
|
.Em write
|
|
|
|
operation, or copying files during a
|
|
|
|
.Em copy
|
|
|
|
operation, archive members are
|
|
|
|
.Sq selected ,
|
|
|
|
based only on the user specified pathnames as modified by the
|
|
|
|
.Fl n ,
|
|
|
|
.Fl u ,
|
|
|
|
.Fl D ,
|
|
|
|
.Fl G ,
|
|
|
|
.Fl T ,
|
2001-10-28 22:03:12 +03:00
|
|
|
and
|
1994-06-13 20:13:35 +04:00
|
|
|
.Fl U
|
|
|
|
options (the
|
|
|
|
.Fl D
|
|
|
|
option only applies during a copy operation).
|
|
|
|
Then any
|
2001-10-28 22:03:12 +03:00
|
|
|
.Fl s
|
1994-06-13 20:13:35 +04:00
|
|
|
and
|
|
|
|
.Fl i
|
|
|
|
options will modify in that order, the names of these selected files.
|
|
|
|
Then during a
|
|
|
|
.Em copy
|
|
|
|
operation the
|
|
|
|
.Fl Y
|
|
|
|
and the
|
|
|
|
.Fl Z
|
|
|
|
options will be applied based on the final pathname.
|
|
|
|
Finally the
|
|
|
|
.Fl v
|
|
|
|
option will write the names resulting from these modifications.
|
|
|
|
.Pp
|
|
|
|
When one or both of the
|
|
|
|
.Fl u
|
|
|
|
or
|
|
|
|
.Fl D
|
|
|
|
options are specified along with the
|
|
|
|
.Fl n
|
|
|
|
option, a file is not considered selected unless it is newer
|
|
|
|
than the file to which it is compared.
|
|
|
|
.Sh EXAMPLES
|
|
|
|
The command:
|
2001-10-28 22:03:12 +03:00
|
|
|
.Dl pax -w -f /dev/rst0 \&.
|
1994-06-13 20:13:35 +04:00
|
|
|
copies the contents of the current directory to the device
|
|
|
|
.Pa /dev/rst0 .
|
|
|
|
.Pp
|
|
|
|
The command:
|
1996-12-19 02:37:11 +03:00
|
|
|
.Dl pax -v -f filename
|
1994-06-13 20:13:35 +04:00
|
|
|
gives the verbose table of contents for an archive stored in
|
|
|
|
.Pa filename .
|
|
|
|
.Pp
|
|
|
|
The following commands:
|
|
|
|
.Dl mkdir newdir
|
|
|
|
.Dl cd olddir
|
2001-11-07 06:17:24 +03:00
|
|
|
.Dl pax -rw -pp .\ ../newdir
|
1994-06-13 20:13:35 +04:00
|
|
|
will copy the entire
|
|
|
|
.Pa olddir
|
|
|
|
directory hierarchy to
|
2001-11-07 06:17:24 +03:00
|
|
|
.Pa newdir ,
|
2001-11-08 03:02:10 +03:00
|
|
|
preserving permissions and access times.
|
|
|
|
.Pp
|
|
|
|
When running as root, one may also wish to preserve file
|
|
|
|
ownership when copying directory trees. This can
|
|
|
|
be done with the following commands:
|
|
|
|
.Dl cd olddir
|
|
|
|
.Dl pax -rw -pe .\ .../newdir
|
|
|
|
which will copy the contents of
|
|
|
|
.Pa olddir
|
|
|
|
into
|
|
|
|
.Pa .../newdir ,
|
|
|
|
preserving ownership, permissions and access times.
|
1994-06-13 20:13:35 +04:00
|
|
|
.Pp
|
|
|
|
The command:
|
|
|
|
.Dl pax -r -s ',^//*usr//*,,' -f a.pax
|
2001-10-28 22:03:12 +03:00
|
|
|
reads the archive
|
1994-06-13 20:13:35 +04:00
|
|
|
.Pa a.pax ,
|
|
|
|
with all files rooted in ``/usr'' into the archive extracted relative to the
|
|
|
|
current directory.
|
|
|
|
.Pp
|
|
|
|
The command:
|
|
|
|
.Dl pax -rw -i .\ dest_dir
|
|
|
|
can be used to interactively select the files to copy from the current
|
|
|
|
directory to
|
|
|
|
.Pa dest_dir .
|
|
|
|
.Pp
|
|
|
|
The command:
|
|
|
|
.Dl pax -r -pe -U root -G bin -f a.pax
|
|
|
|
will extract all files from the archive
|
|
|
|
.Pa a.pax
|
|
|
|
which are owned by
|
|
|
|
.Em root
|
|
|
|
with group
|
|
|
|
.Em bin
|
|
|
|
and will preserve all file permissions.
|
|
|
|
.Pp
|
|
|
|
The command:
|
|
|
|
.Dl pax -r -w -v -Y -Z home /backup
|
|
|
|
will update (and list) only those files in the destination directory
|
|
|
|
.Pa /backup
|
|
|
|
which are older (less recent inode change or file modification times) than
|
|
|
|
files with the same name found in the source file tree
|
|
|
|
.Pa home .
|
|
|
|
.Sh ERRORS
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
will exit with one of the following values:
|
|
|
|
.Bl -tag -width 2n
|
|
|
|
.It 0
|
|
|
|
All files were processed successfully.
|
2001-10-28 22:03:12 +03:00
|
|
|
.It 1
|
1994-06-13 20:13:35 +04:00
|
|
|
An error occurred.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Whenever
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
cannot create a file or a link when reading an archive or cannot
|
|
|
|
find a file when writing an archive, or cannot preserve the user ID,
|
|
|
|
group ID, or file mode when the
|
|
|
|
.Fl p
|
|
|
|
option is specified, a diagnostic message is written to
|
|
|
|
.Dv standard error
|
|
|
|
and a non-zero exit status will be returned, but processing will continue.
|
|
|
|
In the case where pax cannot create a link to a file,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
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,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
may have only partially extracted a 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,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
may have only partially created the archive which may violate the specific
|
|
|
|
archive format specification.
|
|
|
|
.Pp
|
|
|
|
If while doing a
|
|
|
|
.Em copy ,
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
detects a file is about to overwrite itself, the file is not copied,
|
|
|
|
a diagnostic message is written to
|
|
|
|
.Dv standard error
|
|
|
|
and when
|
1997-09-14 18:54:32 +04:00
|
|
|
.Nm
|
1994-06-13 20:13:35 +04:00
|
|
|
completes it will exit with a non-zero exit status.
|
2001-10-28 22:03:12 +03:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr cpio 1 ,
|
|
|
|
.Xr tar 1 ,
|
|
|
|
.Xr symlink 7 ,
|
|
|
|
.Xr mtree 8
|
|
|
|
.Sh STANDARDS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is a superset of the
|
|
|
|
.St -p1003.2
|
|
|
|
standard.
|
|
|
|
The options
|
|
|
|
.Fl B ,
|
|
|
|
.Fl D ,
|
|
|
|
.Fl E ,
|
|
|
|
.Fl G ,
|
|
|
|
.Fl H ,
|
|
|
|
.Fl L ,
|
|
|
|
.Fl M ,
|
|
|
|
.Fl O ,
|
|
|
|
.Fl P ,
|
|
|
|
.Fl T ,
|
|
|
|
.Fl U ,
|
|
|
|
.Fl Y ,
|
|
|
|
.Fl Z ,
|
|
|
|
the archive formats
|
|
|
|
.Ar bcpio ,
|
|
|
|
.Ar sv4cpio ,
|
|
|
|
.Ar sv4crc ,
|
|
|
|
.Ar tar ,
|
|
|
|
and the flawed archive handling during
|
|
|
|
.Ar list
|
|
|
|
and
|
|
|
|
.Ar read
|
|
|
|
operations are extensions to the
|
|
|
|
.Tn POSIX
|
|
|
|
standard.
|
|
|
|
.Sh AUTHORS
|
|
|
|
Keith Muller at the University of California, San Diego.
|
|
|
|
Luke Mewburn implemented
|
|
|
|
.Fl M .
|