| [a569125] | 1 | .\" $MirOS: src/bin/pax/tar.1,v 1.22 2012/02/12 02:49:41 tg Exp $
|
|---|
| 2 | .\" $OpenBSD: tar.1,v 1.55 2010/12/02 04:08:27 tedu Exp $
|
|---|
| [c6ac237] | 3 | .\"
|
|---|
| [a569125] | 4 | .\" Copyright (c) 2005, 2008, 2009, 2011, 2012
|
|---|
| 5 | .\" Thorsten Glaser <tg@mirbsd.org>
|
|---|
| [c6ac237] | 6 | .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
|
|---|
| 7 | .\" All rights reserved.
|
|---|
| 8 | .\"
|
|---|
| 9 | .\" Redistribution and use in source and binary forms, with or without
|
|---|
| 10 | .\" modification, are permitted provided that the following conditions
|
|---|
| 11 | .\" are met:
|
|---|
| 12 | .\" 1. Redistributions of source code must retain the above copyright
|
|---|
| 13 | .\" notice, this list of conditions and the following disclaimer.
|
|---|
| 14 | .\" 2. Redistributions in binary form must reproduce the above copyright
|
|---|
| 15 | .\" notice, this list of conditions and the following disclaimer in the
|
|---|
| 16 | .\" documentation and/or other materials provided with the distribution.
|
|---|
| 17 | .\"
|
|---|
| 18 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|---|
| 19 | .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|---|
| 20 | .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|---|
| 21 | .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|---|
| 22 | .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|---|
| 23 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|---|
| 24 | .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|---|
| 25 | .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|---|
| 26 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|---|
| 27 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|---|
| [c41ecbb] | 28 | .\"-
|
|---|
| 29 | .\" Try to make GNU groff and AT&T nroff more compatible
|
|---|
| [a569125] | 30 | .\" * ` generates ‘ in gnroff, so use \`
|
|---|
| 31 | .\" * ' generates ’ in gnroff, \' generates ´, so use \*(aq
|
|---|
| 32 | .\" * - generates ‐ in gnroff, \- generates −, so .tr it to -
|
|---|
| [c41ecbb] | 33 | .\" thus use - for hyphens and \- for minus signs and option dashes
|
|---|
| 34 | .\" * ~ is size-reduced and placed atop in groff, so use \*(TI
|
|---|
| 35 | .\" * ^ is size-reduced and placed atop in groff, so use \*(ha
|
|---|
| 36 | .\" * \(en does not work in nroff, so use \*(en
|
|---|
| [a569125] | 37 | .\" The section after the "doc" macropackage has been loaded contains
|
|---|
| 38 | .\" additional code to convene between the UCB mdoc macropackage (and
|
|---|
| 39 | .\" its variant as BSD mdoc in groff) and the GNU mdoc macropackage.
|
|---|
| 40 | .\"
|
|---|
| [c41ecbb] | 41 | .ie \n(.g \{\
|
|---|
| [a569125] | 42 | . if \*[.T]ascii .tr \-\N'45'
|
|---|
| 43 | . if \*[.T]latin1 .tr \-\N'45'
|
|---|
| 44 | . if \*[.T]utf8 .tr \-\N'45'
|
|---|
| 45 | . ds <= \[<=]
|
|---|
| 46 | . ds >= \[>=]
|
|---|
| 47 | . ds Rq \[rq]
|
|---|
| 48 | . ds Lq \[lq]
|
|---|
| 49 | . ds sL \(aq
|
|---|
| 50 | . ds sR \(aq
|
|---|
| 51 | . if \*[.T]utf8 .ds sL `
|
|---|
| 52 | . if \*[.T]ps .ds sL `
|
|---|
| 53 | . if \*[.T]utf8 .ds sR '
|
|---|
| 54 | . if \*[.T]ps .ds sR '
|
|---|
| [c41ecbb] | 55 | . ds aq \(aq
|
|---|
| 56 | . ds TI \(ti
|
|---|
| 57 | . ds ha \(ha
|
|---|
| 58 | . ds en \(en
|
|---|
| 59 | .\}
|
|---|
| 60 | .el \{\
|
|---|
| 61 | . ds aq '
|
|---|
| 62 | . ds TI ~
|
|---|
| 63 | . ds ha ^
|
|---|
| 64 | . ds en \(em
|
|---|
| 65 | .\}
|
|---|
| 66 | .\"
|
|---|
| 67 | .\" Implement .Dd with the Mdocdate RCS keyword
|
|---|
| [a569125] | 68 | .\"
|
|---|
| [c41ecbb] | 69 | .rn Dd xD
|
|---|
| 70 | .de Dd
|
|---|
| 71 | .ie \\$1$Mdocdate: \{\
|
|---|
| 72 | . xD \\$2 \\$3, \\$4
|
|---|
| 73 | .\}
|
|---|
| 74 | .el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
|
|---|
| 75 | ..
|
|---|
| 76 | .\"
|
|---|
| 77 | .\" .Dd must come before definition of .Mx, because when called
|
|---|
| 78 | .\" with -mandoc, it might implement .Mx itself, but we want to
|
|---|
| 79 | .\" use our own definition. And .Dd must come *first*, always.
|
|---|
| [a569125] | 80 | .\"
|
|---|
| 81 | .Dd $Mdocdate: February 12 2012 $
|
|---|
| 82 | .\"
|
|---|
| 83 | .\" Check which macro package we use
|
|---|
| 84 | .\"
|
|---|
| 85 | .ie \n(.g \{\
|
|---|
| 86 | . ie d volume-ds-1 .ds tT gnu
|
|---|
| 87 | . el .ds tT bsd
|
|---|
| 88 | .\}
|
|---|
| 89 | .el .ds tT ucb
|
|---|
| [c41ecbb] | 90 | .\"
|
|---|
| 91 | .\" Implement .Mx (MirBSD)
|
|---|
| [a569125] | 92 | .\"
|
|---|
| 93 | .ie "\*(tT"gnu" \{\
|
|---|
| 94 | . eo
|
|---|
| 95 | . de Mx
|
|---|
| 96 | . nr curr-font \n[.f]
|
|---|
| 97 | . nr curr-size \n[.ps]
|
|---|
| 98 | . ds str-Mx \f[\n[curr-font]]\s[\n[curr-size]u]
|
|---|
| 99 | . ds str-Mx1 \*[Tn-font-size]\%MirOS\*[str-Mx]
|
|---|
| 100 | . if !\n[arg-limit] \
|
|---|
| 101 | . if \n[.$] \{\
|
|---|
| 102 | . ds macro-name Mx
|
|---|
| 103 | . parse-args \$@
|
|---|
| 104 | . \}
|
|---|
| 105 | . if (\n[arg-limit] > \n[arg-ptr]) \{\
|
|---|
| 106 | . nr arg-ptr +1
|
|---|
| 107 | . ie (\n[type\n[arg-ptr]] == 2) \
|
|---|
| 108 | . as str-Mx1 \~\*[arg\n[arg-ptr]]
|
|---|
| 109 | . el \
|
|---|
| 110 | . nr arg-ptr -1
|
|---|
| 111 | . \}
|
|---|
| 112 | . ds arg\n[arg-ptr] "\*[str-Mx1]
|
|---|
| 113 | . nr type\n[arg-ptr] 2
|
|---|
| 114 | . ds space\n[arg-ptr] "\*[space]
|
|---|
| 115 | . nr num-args (\n[arg-limit] - \n[arg-ptr])
|
|---|
| 116 | . nr arg-limit \n[arg-ptr]
|
|---|
| 117 | . if \n[num-args] \
|
|---|
| 118 | . parse-space-vector
|
|---|
| 119 | . print-recursive
|
|---|
| 120 | ..
|
|---|
| 121 | . ec
|
|---|
| 122 | . ds sP \s0
|
|---|
| 123 | . ds tN \*[Tn-font-size]
|
|---|
| [3f0223f] | 124 | .\}
|
|---|
| [a569125] | 125 | .el \{\
|
|---|
| 126 | . de Mx
|
|---|
| 127 | . nr cF \\n(.f
|
|---|
| 128 | . nr cZ \\n(.s
|
|---|
| 129 | . ds aa \&\f\\n(cF\s\\n(cZ
|
|---|
| 130 | . if \\n(aC==0 \{\
|
|---|
| 131 | . ie \\n(.$==0 \&MirOS\\*(aa
|
|---|
| 132 | . el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
|
|---|
| 133 | . \}
|
|---|
| 134 | . if \\n(aC>\\n(aP \{\
|
|---|
| 135 | . nr aP \\n(aP+1
|
|---|
| 136 | . ie \\n(C\\n(aP==2 \{\
|
|---|
| 137 | . as b1 \&MirOS\ #\&\\*(A\\n(aP\\*(aa
|
|---|
| 138 | . ie \\n(aC>\\n(aP \{\
|
|---|
| 139 | . nr aP \\n(aP+1
|
|---|
| 140 | . nR
|
|---|
| 141 | . \}
|
|---|
| 142 | . el .aZ
|
|---|
| 143 | . \}
|
|---|
| 144 | . el \{\
|
|---|
| 145 | . as b1 \&MirOS\\*(aa
|
|---|
| [c41ecbb] | 146 | . nR
|
|---|
| 147 | . \}
|
|---|
| 148 | . \}
|
|---|
| [3f0223f] | 149 | ..
|
|---|
| [a569125] | 150 | .\}
|
|---|
| 151 | .\"-
|
|---|
| 152 | .ie \ng==1 \{\
|
|---|
| 153 | . ds nc mircpio
|
|---|
| 154 | . ds np mirpax
|
|---|
| 155 | . ds nt mirtar
|
|---|
| 156 | . ds nm mirtar
|
|---|
| 157 | . Dt MIRTAR 1
|
|---|
| 158 | .\}
|
|---|
| 159 | .el .ie \ng==2 \{\
|
|---|
| 160 | . ds nc paxcpio
|
|---|
| 161 | . ds np pax
|
|---|
| 162 | . ds nt paxtar
|
|---|
| 163 | . ds nm paxtar
|
|---|
| 164 | . Dt PAXTAR 1
|
|---|
| 165 | .\}
|
|---|
| 166 | .el \{\
|
|---|
| 167 | . ds nc cpio
|
|---|
| 168 | . ds np pax
|
|---|
| 169 | . ds nt tar
|
|---|
| 170 | . ds nm tar
|
|---|
| 171 | . Dt TAR 1
|
|---|
| 172 | .\}
|
|---|
| 173 | .\"-
|
|---|
| [c41ecbb] | 174 | .Os MirBSD
|
|---|
| [c6ac237] | 175 | .Sh NAME
|
|---|
| [a569125] | 176 | .ie \ng==1 \{\
|
|---|
| 177 | .Nm mirtar
|
|---|
| 178 | .Nd tape archiver
|
|---|
| 179 | .\}
|
|---|
| 180 | .el .ie \ng==2 \{\
|
|---|
| 181 | .Nm paxtar
|
|---|
| 182 | .Nd tape archiver
|
|---|
| 183 | .\}
|
|---|
| 184 | .el \{\
|
|---|
| [c6ac237] | 185 | .Nm tar
|
|---|
| 186 | .Nd tape archiver
|
|---|
| [a569125] | 187 | .\}
|
|---|
| [c6ac237] | 188 | .Sh SYNOPSIS
|
|---|
| [a569125] | 189 | .Nm \*(nm
|
|---|
| [c6ac237] | 190 | .Sm off
|
|---|
| [a569125] | 191 | .No { Cm crtux No } Op Cm 014578AbefHhJjLmNOoPRSpqsvwXZz
|
|---|
| [c6ac237] | 192 | .Sm on
|
|---|
| 193 | .Bk -words
|
|---|
| 194 | .Op Ar blocking-factor | archive | replstr
|
|---|
| 195 | .Op Fl C Ar directory
|
|---|
| 196 | .Op Fl I Ar file
|
|---|
| [a569125] | 197 | .Op Ar
|
|---|
| [c6ac237] | 198 | .Ek
|
|---|
| [a569125] | 199 | .Nm \*(nm
|
|---|
| [c6ac237] | 200 | .No { Ns Fl crtux Ns }
|
|---|
| [a569125] | 201 | .Bk -words
|
|---|
| 202 | .Op Fl 014578AeHhJjLmNOoPpqRSvwXZz
|
|---|
| [c6ac237] | 203 | .Op Fl b Ar blocking-factor
|
|---|
| 204 | .Op Fl C Ar directory
|
|---|
| 205 | .Op Fl f Ar archive
|
|---|
| 206 | .Op Fl I Ar file
|
|---|
| [c41ecbb] | 207 | .Op Fl M Ar flag
|
|---|
| [c6ac237] | 208 | .Op Fl s Ar replstr
|
|---|
| [a569125] | 209 | .Op Ar
|
|---|
| 210 | .Ek
|
|---|
| [c6ac237] | 211 | .Sh DESCRIPTION
|
|---|
| 212 | The
|
|---|
| 213 | .Nm
|
|---|
| 214 | command creates, adds files to, or extracts files from an
|
|---|
| 215 | archive file in
|
|---|
| 216 | .Dq tar
|
|---|
| 217 | format.
|
|---|
| 218 | A tar archive is often stored on a magnetic tape, but can be
|
|---|
| 219 | stored equally well on a floppy, CD-ROM, or in a regular disk file.
|
|---|
| 220 | .Pp
|
|---|
| 221 | In the first (legacy) form, all option flags except for
|
|---|
| 222 | .Fl C
|
|---|
| 223 | and
|
|---|
| 224 | .Fl I
|
|---|
| 225 | must be contained within the first argument to
|
|---|
| 226 | .Nm
|
|---|
| 227 | and must not be prefixed by a hyphen
|
|---|
| [a569125] | 228 | .Pq Sq \- .
|
|---|
| [c6ac237] | 229 | Option arguments, if any, are processed as subsequent arguments to
|
|---|
| 230 | .Nm
|
|---|
| 231 | and are processed in the order in which their corresponding option
|
|---|
| 232 | flags have been presented on the command line.
|
|---|
| 233 | .Pp
|
|---|
| 234 | In the second and preferred form, option flags may be given in any order
|
|---|
| 235 | and are immediately followed by their corresponding option argument
|
|---|
| 236 | values.
|
|---|
| 237 | .Pp
|
|---|
| 238 | One of the following flags must be present:
|
|---|
| 239 | .Bl -tag -width Ds
|
|---|
| 240 | .It Fl c
|
|---|
| 241 | Create new archive, or overwrite an existing archive,
|
|---|
| 242 | adding the specified files to it.
|
|---|
| 243 | .It Fl r
|
|---|
| 244 | Append the named new files to existing archive.
|
|---|
| 245 | Note that this will only work on media on which an end-of-file mark
|
|---|
| 246 | can be overwritten.
|
|---|
| 247 | .It Fl t
|
|---|
| 248 | List contents of archive.
|
|---|
| 249 | If any files are named on the
|
|---|
| 250 | command line, only those files will be listed.
|
|---|
| 251 | The
|
|---|
| 252 | .Ar file
|
|---|
| 253 | arguments may be specified as glob patterns (see
|
|---|
| 254 | .Xr glob 3
|
|---|
| 255 | for more information), in which case
|
|---|
| 256 | .Nm
|
|---|
| 257 | will list all archive members that match each pattern.
|
|---|
| 258 | .It Fl u
|
|---|
| 259 | Alias for
|
|---|
| 260 | .Fl r .
|
|---|
| 261 | .It Fl x
|
|---|
| 262 | Extract files from archive.
|
|---|
| 263 | If any files are named on the
|
|---|
| 264 | command line, only those files will be extracted from the
|
|---|
| 265 | archive.
|
|---|
| 266 | The
|
|---|
| 267 | .Ar file
|
|---|
| 268 | arguments may be specified as glob patterns (see
|
|---|
| 269 | .Xr glob 3
|
|---|
| 270 | for more information), in which case
|
|---|
| 271 | .Nm
|
|---|
| 272 | will extract all archive members that match each pattern.
|
|---|
| 273 | .Pp
|
|---|
| 274 | If more than one copy of a file exists in the
|
|---|
| 275 | archive, later copies will overwrite earlier copies during
|
|---|
| 276 | extraction.
|
|---|
| 277 | The file mode and modification time are preserved
|
|---|
| 278 | if possible.
|
|---|
| 279 | The file mode is subject to modification by the
|
|---|
| 280 | .Xr umask 2 .
|
|---|
| 281 | .El
|
|---|
| 282 | .Pp
|
|---|
| 283 | In addition to the flags mentioned above, any of the following
|
|---|
| 284 | flags may be used:
|
|---|
| 285 | .Bl -tag -width Ds
|
|---|
| [a569125] | 286 | .It Fl A
|
|---|
| 287 | Write Unix Archiver libraries instead of tape archives.
|
|---|
| [c6ac237] | 288 | .It Fl b Ar blocking-factor
|
|---|
| 289 | Set blocking factor to use for the archive.
|
|---|
| 290 | .Nm
|
|---|
| 291 | uses 512-byte blocks.
|
|---|
| 292 | The default is 20, the maximum is 126.
|
|---|
| 293 | Archives with a blocking factor larger than 63 violate the
|
|---|
| 294 | .Tn POSIX
|
|---|
| 295 | standard and will not be portable to all systems.
|
|---|
| 296 | .It Fl C Ar directory
|
|---|
| 297 | This is a positional argument which sets the working directory for the
|
|---|
| 298 | following files.
|
|---|
| 299 | When extracting, files will be extracted into
|
|---|
| 300 | the specified directory; when creating, the specified files will be matched
|
|---|
| 301 | from the directory.
|
|---|
| 302 | .It Fl e
|
|---|
| 303 | Stop after the first error.
|
|---|
| 304 | .It Fl f Ar archive
|
|---|
| 305 | Filename where the archive is stored.
|
|---|
| 306 | Defaults to
|
|---|
| 307 | .Pa /dev/rst0 .
|
|---|
| 308 | .It Fl H
|
|---|
| 309 | Follow symlinks given on the command line only.
|
|---|
| 310 | .It Fl h
|
|---|
| 311 | Follow symbolic links as if they were normal files
|
|---|
| 312 | or directories.
|
|---|
| 313 | In extract mode this means that a directory entry in the archive
|
|---|
| 314 | will not overwrite an existing symbolic link, but rather what the
|
|---|
| 315 | link ultimately points to.
|
|---|
| 316 | .It Fl I Ar file
|
|---|
| 317 | This is a positional argument which reads the names of files to
|
|---|
| 318 | archive or extract from the given file, one per line.
|
|---|
| [a569125] | 319 | .It Fl J
|
|---|
| 320 | Use the xz utility to compress the archive.
|
|---|
| 321 | .It Fl j
|
|---|
| 322 | Use the bzip2 utility to compress the archive.
|
|---|
| [c6ac237] | 323 | .It Fl L
|
|---|
| 324 | Synonym for the
|
|---|
| 325 | .Fl h
|
|---|
| 326 | option.
|
|---|
| [c41ecbb] | 327 | .It Fl M Ar flag
|
|---|
| [c6ac237] | 328 | Configure the archive normaliser.
|
|---|
| [c41ecbb] | 329 | .Ar flag
|
|---|
| [a569125] | 330 | is either a numeric value compatible to
|
|---|
| 331 | .Xr strtonum 3
|
|---|
| 332 | which is directly stored in the flags word, or
|
|---|
| 333 | one of the following values, optionally prefixed with
|
|---|
| 334 | .Dq no\-
|
|---|
| 335 | to turn them off:
|
|---|
| [c6ac237] | 336 | .Pp
|
|---|
| 337 | .Bl -tag -width xxxxxx -compact
|
|---|
| 338 | .It Ar inodes
|
|---|
| 339 | 0x0001: Serialise inodes, zero device info.
|
|---|
| [a569125] | 340 | .br
|
|---|
| 341 | (cpio, sv4cpio, sv4crc)
|
|---|
| [c6ac237] | 342 | .It Ar links
|
|---|
| 343 | 0x0002: Store content of hard links only once.
|
|---|
| [a569125] | 344 | .br
|
|---|
| 345 | (cpio, sv4cpio, sv4crc)
|
|---|
| [c6ac237] | 346 | .It Ar mtime
|
|---|
| 347 | 0x0004: Zero out the file modification time.
|
|---|
| [a569125] | 348 | .br
|
|---|
| 349 | (ar, cpio, sv4cpio, sv4crc, ustar)
|
|---|
| [c6ac237] | 350 | .It Ar uidgid
|
|---|
| 351 | 0x0008: Set owner to 0:0 (root:wheel).
|
|---|
| [a569125] | 352 | .br
|
|---|
| 353 | (ar, cpio, sv4cpio, sv4crc, ustar)
|
|---|
| 354 | .It Ar verb
|
|---|
| 355 | 0x0010: Debug this option.
|
|---|
| 356 | .It Ar debug
|
|---|
| 357 | 0x0020: Debug file header storage.
|
|---|
| [6892a93] | 358 | .It Ar lncp
|
|---|
| [a569125] | 359 | 0x0040: Extract hard links by copy if link fails.
|
|---|
| 360 | .It Ar numid
|
|---|
| 361 | 0x0080: Use only numeric uid and gid values.
|
|---|
| 362 | .br
|
|---|
| 363 | (ustar)
|
|---|
| 364 | .It Ar gslash
|
|---|
| 365 | 0x0100: Append a slash after directory names.
|
|---|
| 366 | .br
|
|---|
| 367 | (ustar)
|
|---|
| 368 | .It Ar set
|
|---|
| 369 | 0x0003: Keep ownership and mtime intact.
|
|---|
| 370 | .It Ar dist
|
|---|
| 371 | 0x008B: Clean everything except mtime.
|
|---|
| 372 | .It Ar norm
|
|---|
| 373 | 0x008F: Clean everything.
|
|---|
| 374 | .It Ar root
|
|---|
| 375 | 0x0089: Clean owner and device information.
|
|---|
| [c6ac237] | 376 | .El
|
|---|
| 377 | .Pp
|
|---|
| [a569125] | 378 | This option is only implemented for the ar, cpio, sv4cpio,
|
|---|
| [3f0223f] | 379 | sv4crc, and ustar file format writing routines.
|
|---|
| [c6ac237] | 380 | .It Fl m
|
|---|
| 381 | Do not preserve modification time.
|
|---|
| [a569125] | 382 | .It Fl N
|
|---|
| 383 | Same as
|
|---|
| 384 | .Fl M Ar numid .
|
|---|
| [c6ac237] | 385 | .It Fl O
|
|---|
| [dbbcad4] | 386 | If reading, extract files to standard output.
|
|---|
| 387 | .br
|
|---|
| 388 | If writing, write old-style (non-POSIX) archives.
|
|---|
| [c6ac237] | 389 | .It Fl o
|
|---|
| 390 | Don't write directory information that the older (V7) style
|
|---|
| [a569125] | 391 | .Nm tar
|
|---|
| [c6ac237] | 392 | is unable to decode.
|
|---|
| 393 | This implies the
|
|---|
| 394 | .Fl O
|
|---|
| 395 | flag.
|
|---|
| 396 | .It Fl P
|
|---|
| 397 | Do not strip leading slashes
|
|---|
| 398 | .Pq Sq /
|
|---|
| 399 | from pathnames.
|
|---|
| 400 | The default is to strip leading slashes.
|
|---|
| 401 | .It Fl p
|
|---|
| 402 | Preserve user and group ID as well as file mode regardless of
|
|---|
| 403 | the current
|
|---|
| 404 | .Xr umask 2 .
|
|---|
| 405 | The setuid and setgid bits are only preserved if the user is
|
|---|
| 406 | the superuser.
|
|---|
| 407 | Only meaningful in conjunction with the
|
|---|
| 408 | .Fl x
|
|---|
| 409 | flag.
|
|---|
| 410 | .It Fl q
|
|---|
| 411 | Select the first archive member that matches each
|
|---|
| 412 | .Ar file
|
|---|
| 413 | operand.
|
|---|
| 414 | No more than one archive member is matched for each
|
|---|
| 415 | .Ar file .
|
|---|
| 416 | When members of type directory are matched, the file hierarchy rooted at that
|
|---|
| 417 | directory is also matched.
|
|---|
| 418 | .It Fl R
|
|---|
| 419 | Write SysVR4 CPIO files instead of tar or POSIX ustar files.
|
|---|
| 420 | Serialise inode numbers, zero out device information.
|
|---|
| 421 | The file content of hard links is stored only once.
|
|---|
| 422 | .It Fl S
|
|---|
| 423 | Write SysVR4 CPIO files with CRC instead of tar or POSIX ustar files.
|
|---|
| 424 | Serialise inode numbers, zero out device information.
|
|---|
| 425 | The file content of hard links is stored only once.
|
|---|
| 426 | .It Fl s Ar replstr
|
|---|
| 427 | Modify the archive member names according to the substitution expression
|
|---|
| 428 | .Ar replstr ,
|
|---|
| 429 | using the syntax of the
|
|---|
| 430 | .Xr ed 1
|
|---|
| 431 | utility regular expressions.
|
|---|
| 432 | .Ar file
|
|---|
| 433 | arguments may be given to restrict the list of archive members to those
|
|---|
| 434 | specified.
|
|---|
| 435 | .Pp
|
|---|
| 436 | The format of these regular expressions is
|
|---|
| 437 | .Pp
|
|---|
| 438 | .Dl /old/new/[gp]
|
|---|
| 439 | .Pp
|
|---|
| 440 | As in
|
|---|
| 441 | .Xr ed 1 ,
|
|---|
| 442 | .Va old
|
|---|
| 443 | is a basic regular expression (see
|
|---|
| 444 | .Xr re_format 7 )
|
|---|
| 445 | and
|
|---|
| 446 | .Va new
|
|---|
| 447 | can contain an ampersand
|
|---|
| 448 | .Pq Ql & ,
|
|---|
| 449 | .Ql \e Ns Em n
|
|---|
| 450 | (where
|
|---|
| 451 | .Em n
|
|---|
| 452 | is a digit) back-references,
|
|---|
| 453 | or subexpression matching.
|
|---|
| 454 | The
|
|---|
| 455 | .Va old
|
|---|
| 456 | string may also contain newline characters.
|
|---|
| 457 | Any non-null character can be used as a delimiter
|
|---|
| 458 | .Po
|
|---|
| 459 | .Ql /
|
|---|
| 460 | is shown here
|
|---|
| 461 | .Pc .
|
|---|
| 462 | Multiple
|
|---|
| 463 | .Fl s
|
|---|
| 464 | expressions can be specified.
|
|---|
| 465 | The expressions are applied in the order they are specified on the
|
|---|
| 466 | command line, terminating with the first successful substitution.
|
|---|
| 467 | .Pp
|
|---|
| 468 | The optional trailing
|
|---|
| 469 | .Cm g
|
|---|
| 470 | continues to apply the substitution expression to the pathname substring,
|
|---|
| 471 | which starts with the first character following the end of the last successful
|
|---|
| 472 | substitution.
|
|---|
| 473 | The first unsuccessful substitution stops the operation of the
|
|---|
| 474 | .Cm g
|
|---|
| 475 | option.
|
|---|
| 476 | The optional trailing
|
|---|
| 477 | .Cm p
|
|---|
| 478 | will cause the final result of a successful substitution to be written to
|
|---|
| 479 | standard error in the following format:
|
|---|
| 480 | .Pp
|
|---|
| [a569125] | 481 | .D1 Em original-pathname No \*(Gt\*(Gt Em new-pathname
|
|---|
| [c6ac237] | 482 | .Pp
|
|---|
| 483 | File or archive member names that substitute to the empty string
|
|---|
| 484 | are not selected and will be skipped.
|
|---|
| 485 | .It Fl v
|
|---|
| 486 | Verbose operation mode.
|
|---|
| 487 | .It Fl w
|
|---|
| 488 | Interactively rename files.
|
|---|
| 489 | This option causes
|
|---|
| 490 | .Nm
|
|---|
| 491 | to prompt the user for the filename to use when storing or
|
|---|
| 492 | extracting files in an archive.
|
|---|
| 493 | .It Fl X
|
|---|
| 494 | Do not cross mount points in the file system.
|
|---|
| 495 | .It Fl Z
|
|---|
| [a569125] | 496 | Use the
|
|---|
| 497 | .Xr compress 1
|
|---|
| 498 | utility to compress the archive.
|
|---|
| [c6ac237] | 499 | .It Fl z
|
|---|
| [a569125] | 500 | Use the
|
|---|
| 501 | .Xr gzip 1
|
|---|
| 502 | utility to compress the archive.
|
|---|
| [c6ac237] | 503 | .El
|
|---|
| 504 | .Pp
|
|---|
| 505 | The options
|
|---|
| 506 | .Op Fl 014578
|
|---|
| 507 | can be used to select one of the compiled-in backup devices,
|
|---|
| 508 | .Pa /dev/rstN .
|
|---|
| 509 | .Sh ENVIRONMENT
|
|---|
| 510 | .Bl -tag -width Fl
|
|---|
| 511 | .It Ev TMPDIR
|
|---|
| 512 | Path in which to store temporary files.
|
|---|
| 513 | .It Ev TAPE
|
|---|
| 514 | Default tape device to use instead of
|
|---|
| 515 | .Pa /dev/rst0 .
|
|---|
| 516 | .El
|
|---|
| 517 | .Sh FILES
|
|---|
| 518 | .Bl -tag -width "/dev/rst0"
|
|---|
| 519 | .It Pa /dev/rst0
|
|---|
| 520 | default archive name
|
|---|
| 521 | .El
|
|---|
| [a569125] | 522 | .Sh EXIT STATUS
|
|---|
| 523 | The
|
|---|
| 524 | .Nm
|
|---|
| 525 | utility exits with one of the following values:
|
|---|
| 526 | .Pp
|
|---|
| 527 | .Bl -tag -width Ds -offset indent -compact
|
|---|
| 528 | .It 0
|
|---|
| 529 | All files were processed successfully.
|
|---|
| 530 | .It 1
|
|---|
| 531 | An error occurred.
|
|---|
| 532 | .El
|
|---|
| [c6ac237] | 533 | .Sh EXAMPLES
|
|---|
| 534 | Create an archive on the default tape drive, containing the files named
|
|---|
| 535 | .Pa bonvole
|
|---|
| 536 | and
|
|---|
| 537 | .Pa sekve :
|
|---|
| 538 | .Pp
|
|---|
| [a569125] | 539 | .Dl $ \*(nm c bonvole sekve
|
|---|
| [c6ac237] | 540 | .Pp
|
|---|
| 541 | Output a
|
|---|
| 542 | .Xr gzip 1
|
|---|
| 543 | compressed archive containing the files
|
|---|
| 544 | .Pa bonvole
|
|---|
| 545 | and
|
|---|
| 546 | .Pa sekve
|
|---|
| 547 | to a file called
|
|---|
| 548 | .Pa foriru.tar.gz :
|
|---|
| 549 | .Pp
|
|---|
| [a569125] | 550 | .Dl $ \*(nm zcf foriru.tar.gz bonvole sekve
|
|---|
| [c6ac237] | 551 | .Pp
|
|---|
| 552 | Verbosely create an archive, called
|
|---|
| 553 | .Pa backup.tar.gz ,
|
|---|
| 554 | of all files matching the shell
|
|---|
| 555 | .Xr glob 3
|
|---|
| 556 | function
|
|---|
| 557 | .Pa *.c :
|
|---|
| 558 | .Pp
|
|---|
| [a569125] | 559 | .Dl $ \*(nm zcvf backup.tar.gz *.c
|
|---|
| [c6ac237] | 560 | .Pp
|
|---|
| 561 | Verbosely list, but do not extract, all files ending in
|
|---|
| 562 | .Pa .jpeg
|
|---|
| 563 | from a compressed archive named
|
|---|
| 564 | .Pa backup.tar.gz .
|
|---|
| 565 | Note that the glob pattern has been quoted to avoid expansion by the shell:
|
|---|
| 566 | .Pp
|
|---|
| [a569125] | 567 | .Dl $ \*(nm tvzf backup.tar.gz \*(aq*.jpeg\*(aq
|
|---|
| [c6ac237] | 568 | .Pp
|
|---|
| 569 | For more detailed examples, see
|
|---|
| [a569125] | 570 | .Xr \*(np 1 .
|
|---|
| [c6ac237] | 571 | .Sh DIAGNOSTICS
|
|---|
| 572 | Whenever
|
|---|
| 573 | .Nm
|
|---|
| 574 | cannot create a file or a link when extracting an archive or cannot
|
|---|
| 575 | find a file while writing an archive, or cannot preserve the user
|
|---|
| 576 | ID, group ID, file mode, or access and modification times when the
|
|---|
| 577 | .Fl p
|
|---|
| 578 | option is specified, a diagnostic message is written to standard
|
|---|
| 579 | error and a non-zero exit value will be returned, but processing
|
|---|
| 580 | will continue.
|
|---|
| 581 | In the case where
|
|---|
| 582 | .Nm
|
|---|
| 583 | cannot create a link to a file,
|
|---|
| [6892a93] | 584 | unless
|
|---|
| 585 | .Fl M Ar lncp
|
|---|
| 586 | is given,
|
|---|
| [c6ac237] | 587 | .Nm
|
|---|
| 588 | will not create a second copy of the file.
|
|---|
| 589 | .Pp
|
|---|
| 590 | If the extraction of a file from an archive is prematurely terminated
|
|---|
| 591 | by a signal or error,
|
|---|
| 592 | .Nm
|
|---|
| 593 | may have only partially extracted the file the user wanted.
|
|---|
| 594 | Additionally, the file modes of extracted files and directories may
|
|---|
| 595 | have incorrect file bits, and the modification and access times may
|
|---|
| 596 | be wrong.
|
|---|
| 597 | .Pp
|
|---|
| 598 | If the creation of an archive is prematurely terminated by a signal
|
|---|
| 599 | or error,
|
|---|
| 600 | .Nm
|
|---|
| 601 | may have only partially created the archive, which may violate the
|
|---|
| 602 | specific archive format specification.
|
|---|
| 603 | .Sh SEE ALSO
|
|---|
| [a569125] | 604 | .Xr ar 1 ,
|
|---|
| [c6ac237] | 605 | .Xr cpio 1 ,
|
|---|
| [a569125] | 606 | .ie \ng==1 \{\
|
|---|
| 607 | .Xr mircpio 1 ,
|
|---|
| 608 | .Xr mirpax 1 ,
|
|---|
| 609 | .Xr pax 1 ,
|
|---|
| 610 | .Xr tar 1 ,
|
|---|
| 611 | .Xr deb 5
|
|---|
| 612 | .\}
|
|---|
| 613 | .el .ie \ng==2 \{\
|
|---|
| 614 | .Xr pax 1 ,
|
|---|
| 615 | .Xr paxcpio 1 ,
|
|---|
| 616 | .Xr tar 1 ,
|
|---|
| 617 | .Xr deb 5
|
|---|
| 618 | .\}
|
|---|
| 619 | .el \{\
|
|---|
| [c6ac237] | 620 | .Xr pax 1
|
|---|
| [a569125] | 621 | .\}
|
|---|
| [c6ac237] | 622 | .Sh HISTORY
|
|---|
| 623 | A
|
|---|
| [a569125] | 624 | .Nm tar
|
|---|
| [c6ac237] | 625 | command first appeared in
|
|---|
| 626 | .At v7 .
|
|---|
| 627 | .Sh AUTHORS
|
|---|
| 628 | Keith Muller at the University of California, San Diego.
|
|---|
| [a569125] | 629 | .Pp
|
|---|
| 630 | .Mx
|
|---|
| 631 | extensions by
|
|---|
| 632 | .An Thorsten Glaser Aq tg@mirbsd.org .
|
|---|
| [c6ac237] | 633 | .Sh CAVEATS
|
|---|
| [a569125] | 634 | The flags
|
|---|
| 635 | .Fl AJjLMNRS
|
|---|
| 636 | are not portable to other implementations of
|
|---|
| 637 | .Nm tar
|
|---|
| 638 | where they may have a different meaning.
|
|---|