add a config file for git-buildpackage
[debian/pax] / tar.1
1 .\"
2 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\"    must display the following acknowledgement:
15 .\"      This product includes software developed by SigmaSoft, Th. Lockert.
16 .\" 4. The name of the author may not be used to endorse or promote products
17 .\"    derived from this software without specific prior written permission
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 .\"
30 .\"     $OpenBSD: tar.1,v 1.17 1998/09/23 00:13:49 aaron Exp $
31 .\"
32 .Dd June 11, 1996
33 .Dt TAR 1
34 .Os
35 .Sh NAME
36 .Nm tar
37 .Nd tape archiver
38 .Sh SYNOPSIS
39 .Nm
40 .No [-]{crtux}[befhjmopvwzHLPXZ014578]
41 .Op Ar archive
42 .Op Ar blocksize
43 .\" XXX how to do this right?
44 .No [-C
45 .Ar directory
46 .No ]
47 .No [-s
48 .Ar replstr
49 .No ]
50 .Ar file1
51 .Op Ar file2 ...
52 .Sh DESCRIPTION
53 The
54 .Nm
55 command creates, adds files to, or extracts files from an
56 archive file in \*Qtar\*U format.  A tar archive is often
57 stored on a magnetic tape, but can be a floppy or a regular
58 disk file.
59 .Pp
60 One of the following flags must be present:
61 .Bl -tag -width Ar
62 .It Fl c
63 Create new archive, or overwrite an existing archive,
64 adding the specified files to it.
65 .It Fl r
66 Append the named new files to existing archive.  Note that
67 this will only work on media on which an end-of-file mark
68 can be overwritten.
69 .It Fl t
70 List contents of archive.  If any files are named on the
71 command line, only those files will be listed.
72 .It Fl u
73 Alias for
74 .Fl r .
75 .It Fl x
76 Extract files from archive.  If any files are named on the
77 command line, only those files will be extracted from the
78 archive.  If more than one copy of a file exists in the
79 archive, later copies will overwrite earlier copies during
80 extraction.  The file mode and modification time are preserved
81 if possible.  The file mode is subject to modification by the
82 .Xr umask 2 .
83 .El
84 .Pp
85 In addition to the flags mentioned above, any of the following
86 flags may be used:
87 .Bl -tag -width Ar
88 .It Fl b Ar "blocking factor"
89 Set blocking factor to use for the archive.
90 .Nm
91 uses 512 byte blocks.  The default is 20, the maximum is 126.
92 Archives with a blocking factor larger 63 violate the
93 .Tn POSIX
94 standard and will not be portable to all systems.
95 .It Fl e
96 Stop after first error.
97 .It Fl f Ar archive
98 Filename where the archive is stored.  Defaults to
99 .Pa /dev/rst0 .
100 .It Fl h
101 Follow symbolic links as if they were normal files
102 or directories.
103 .It Fl j
104 Filter archive through bzip2.
105 .It Fl m
106 Do not preserve modification time.
107 .It Fl O
108 Write old-style (non-POSIX) archives.
109 .It Fl o
110 Don't write directory information that the older (V7) style
111 .Nm
112 is unable to decode.
113 This implies the
114 .Fl O
115 flag.
116 .It Fl p
117 Preserve user and group ID as well as file mode regardless of
118 the current
119 .Xr umask 2 .
120 The setuid and setgid bits are only preserved if the user is
121 the superuser.  Only meaningful in conjunction with the
122 .Fl x
123 flag.
124 .It Fl s Ar replstr
125 Modify the file or archive member names specified by the
126 .Ar pattern
127 or
128 .Ar file
129 operands according to the substitution expression
130 .Ar replstr ,
131 using the syntax of the
132 .Xr ed 1
133 utility regular expressions.
134 The format of these regular expressions are:
135 .Dl /old/new/[gp]
136 As in
137 .Xr ed 1 ,
138 .Cm old
139 is a basic regular expression and
140 .Cm new
141 can contain an ampersand (&), \\n (where n is a digit) back-references,
142 or subexpression matching.
143 The
144 .Cm old
145 string may also contain
146 .Dv <newline>
147 characters.
148 Any non-null character can be used as a delimiter (/ is shown here).
149 Multiple
150 .Fl s
151 expressions can be specified.
152 The expressions are applied in the order they are specified on the
153 command line, terminating with the first successful substitution.
154 The optional trailing
155 .Cm g
156 continues to apply the substitution expression to the pathname substring
157 which starts with the first character following the end of the last successful
158 substitution. The first unsuccessful substitution stops the operation of the
159 .Cm g
160 option.
161 The optional trailing
162 .Cm p
163 will cause the final result of a successful substitution to be written to
164 .Dv standard error
165 in the following format:
166 .Dl <original pathname> >> <new pathname>
167 File or archive member names that substitute to the empty string
168 are not selected and will be skipped.
169 .It Fl v
170 Verbose operation mode.
171 .It Fl w
172 Interactively rename files.  This option causes
173 .Nm
174 to prompt the user for the filename to use when storing or
175 extracting files in an archive.
176 .It Fl z
177 Filter archive through gzip.
178 .It Fl C Ar directory
179 This is a positional argument which sets the working directory for the
180 following files.  When extracting, files will be extracted into
181 the specified directory; when creating, the specified files will be matched
182 from the directory.
183 .It Fl H
184 Follow symlinks given on command line only.
185 .It Fl L
186 Follow all symlinks.
187 .It Fl P
188 Do not strip leading slashes (``/'') from pathnames.
189 The default is to strip leading slashes.
190 .It Fl X
191 Do not cross mount points in the file system.
192 .It Fl Z
193 Filter archive through compress.
194 .El
195 .Pp
196 The options
197 .Op Fl 014578
198 can be used to select one of the compiled-in backup devices,
199 .Pa /dev/rstN .
200 .Sh FILES
201 .Bl -tag -width "/dev/rst0"
202 .It Pa /dev/rst0
203 default archive name
204 .El
205 .Sh SEE ALSO
206 .Xr cpio 1 ,
207 .Xr pax 1
208 .Sh AUTHOR
209 Keith Muller at the University of California, San Diego.
210 .Sh ERRORS
211 .Nm
212 will exit with one of the following values:
213 .Bl -tag -width 2n
214 .It 0
215 All files were processed successfully.
216 .It 1
217 An error occurred.
218 .El
219 .Pp
220 Whenever
221 .Nm
222 cannot create a file or a link when extracting an archive or cannot
223 find a file while writing an archive, or cannot preserve the user
224 ID, group ID, file mode or access and modification times when the
225 .Fl p
226 option is specified, a diagnostic message is written to standard
227 error and a non-zero exit value will be returned, but processing
228 will continue.  In the case where
229 .Nm
230 cannot create a link to a file,
231 .Nm
232 will not create a second copy of the file.
233 .Pp
234 If the extraction of a file from an archive is prematurely terminated
235 by a signal or error,
236 .Nm
237 may have only partially extracted the file the user wanted.
238 Additionally, the file modes of extracted files and directories may
239 have incorrect file bits, and the modification and access times may
240 be wrong.
241 .Pp
242 If the creation of an archive is prematurely terminated by a signal
243 or error,
244 .Nm
245 may have only partially created the archive which may violate the
246 specific archive format specification.