]> Dogcows Code - chaz/tar/blob - doc/tar.1
Provide tar(1) and rmt(8) manpages.
[chaz/tar] / doc / tar.1
1 .\" This file is part of GNU tar. -*- nroff -*-
2 .\" Copyright 2013 Free Software Foundation, Inc.
3 .\"
4 .\" GNU tar is free software; you can redistribute it and/or modify
5 .\" it under the terms of the GNU General Public License as published by
6 .\" the Free Software Foundation; either version 3 of the License, or
7 .\" (at your option) any later version.
8 .\"
9 .\" GNU tar is distributed in the hope that it will be useful,
10 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
11 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 .\" GNU General Public License for more details.
13 .\"
14 .\" You should have received a copy of the GNU General Public License
15 .\" along with this program. If not, see <http://www.gnu.org/licenses/>.
16 .TH TAR 1 "January 27, 2014" "TAR" "GNU TAR Manual"
17 .SH NAME
18 tar \- an archiving utility
19 .SH SYNOPSIS
20 .SS Traditional usage
21 \fBtar\fR {\fBA\fR|\fBc\fR|\fBd\fR|\fBr\fR|\fBt\fR|\fBu\fR|\fBx\fR}\
22 [\fBGnSkUWOmpsMBiajJzZhPlRvwo\fR] [\fIARG\fR...]
23 .SS UNIX-style usage
24 .sp
25 \fBtar\fR \fB\-A\fR [\fIOPTIONS\fR] \fIARCHIVE\fR \fIARCHIVE\fR
26 .sp
27 \fBtar\fR \fB\-c\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
28 .sp
29 \fBtar\fR \fB\-d\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
30 .sp
31 \fBtar\fR \fB\-t\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIMEMBER\fR...]
32 .sp
33 \fBtar\fR \fB\-r\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
34 .sp
35 \fBtar\fR \fB\-u\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
36 .sp
37 \fBtar\fR \fB\-x\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIMEMBER\fR...]
38 .SS GNU-style usage
39 .sp
40 \fBtar\fR {\fB\-\-catenate\fR|\fB\-\-concatenate} [\fIOPTIONS\fR] \fIARCHIVE\fR \fIARCHIVE\fR
41 .sp
42 \fBtar\fR \fB\-\-create\fR [\fB\-\-file\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
43 .sp
44 \fBtar\fR {\fB\-\-diff\fR|\fB\-\-compare\fR} [\fB\-\-file\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
45 .sp
46 \fBtar\fR \fB\-\-delete\fR [\fB\-\-file\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIMEMBER\fR...]
47 .sp
48 \fBtar\fR \fB\-\-append\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
49 .sp
50 \fBtar\fR \fB\-\-list\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIMEMBER\fR...]
51 .sp
52 \fBtar\fR \fB\-\-test\-label\fR [\fB\-\-file\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fILABEL\fR...]
53 .sp
54 \fBtar\fR \fB\-\-update\fR [\fB\-\-file\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
55 .sp
56 \fBtar\fR \fB\-\-update\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
57 .sp
58 \fBtar\fR {\fB\-\-extract\fR|\fB\-\-get\fR} [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIMEMBER\fR...]
59 .SH NOTE
60 This manpage is a short description of GNU \fBtar\fR. For a detailed
61 discussion, including examples and usage recommendations, refer to the
62 \fBGNU Tar Manual\fR available in texinfo format. If the \fBinfo\fR
63 reader and the tar documentation are properly installed on your
64 system, the command
65 .PP
66 .RS +4
67 .B info tar
68 .RE
69 .PP
70 should give you access to the complete manual.
71 .PP
72 You can also view the manual using the info mode in
73 .BR emacs (1),
74 or find it in various formats online at
75 .PP
76 .RS +4
77 .B http://www.gnu.org/software/tar/manual
78 .RE
79 .PP
80 If any discrepancies occur between this manpage and the
81 \fBGNU Tar Manual\fR, the later shall be considered the authoritative
82 source.
83 .SH DESCRIPTION
84 GNU
85 .B tar
86 is an archiving program designed to store multiple files in a single
87 file (an \fBarchive\fR), and to manipulate such archives. The archive
88 can be either a regular file or a device (e.g. a tape drive, hence the name
89 of the program, which stands for \fBt\fRape \fBar\fRchiver), which can
90 be located either on the local or on a remote machine.
91 .PP
92
93 .SS Option styles
94 Options to GNU \fBtar\fR can be given in three different styles.
95 In
96 .BR "traditional style" ,
97 the first argument is a cluster of option letters and all subsequent
98 arguments supply arguments to those options that require them. The
99 arguments are read in the same order as the option letters. Any
100 command line words that remain after all options has been processed
101 are treated as non-optional arguments: file or archive member names.
102 .PP
103 For example, the \fBc\fR option requires creating the archive, the
104 \fBv\fR option requests the verbose operation, and the \fBf\fR option
105 takes an argument that sets the name of the archive to operate upon.
106 The following command, written in the traditional style, instructs tar
107 to store all files from the directory
108 .B /etc
109 into the archive file
110 .B etc.tar
111 verbosely listing the files being archived:
112 .PP
113 .EX
114 .B tar cfv a.tar /etc
115 .EE
116 .PP
117 In
118 .BR "UNIX " or " short-option style" ,
119 each option letter is prefixed with a single dash, as in other command
120 line utilities. If an option takes argument, the argument follows it,
121 either as a separate command line word, or immediately following the
122 option. However, if the option takes an \fBoptional\fR argument, the
123 argument must follow the option letter without any intervening
124 whitespace, as in \fB\-g/tmp/snar.db\fR.
125 .PP
126 Any number of options not taking arguments can be
127 clustered together after a single dash, e.g. \fB\-vkp\fR. Options
128 that take arguments (whether mandatory or optional), can appear at
129 the end of such a cluster, e.g. \fB\-vkpf a.tar\fR.
130 .PP
131 The example command above written in the
132 .B short-option style
133 could look like:
134 .PP
135 .EX
136 .B tar -cvf a.tar /etc
137 or
138 .B tar -c -v -f a.tar /etc
139 .EE
140 .PP
141 In
142 .BR "GNU " or " long-option style" ,
143 each option begins with two dashes and has a meaningful name,
144 consisting of lower-case letters and dashes. When used, the long
145 option can be abbreviated to its initial letters, provided that
146 this does not create ambiguity. Arguments to long options are
147 supplied either as a separate command line word, immediately following
148 the option, or separated from the option by an equals sign with no
149 intervening whitespace. Optional arguments must always use the latter
150 method.
151 .PP
152 Here are several ways of writing the example command in this style:
153 .PP
154 .EX
155 .B tar --create --file a.tar --verbose /etc
156 .EE
157 or (abbreviating some options):
158 .EX
159 .B tar --cre --file=a.tar --verb /etc
160 .EE
161 .PP
162 The options in all three styles can be intermixed, although doing so
163 with old options is not encouraged.
164 .SS Operation mode
165 The options listed in the table below tell GNU \fBtar\fR what
166 operation it is to perform. Exactly one of them must be given.
167 Meaning of non-optional arguments depends on the operation mode
168 requested.
169 .TP
170 \fB\-A\fR, \fB\-\-catenate\fR, \fB\-\-concatenate\fR
171 Append archive to the end of another archive. The arguments are
172 treated as the names of archives to append. All archives must be of
173 the same format as the archive they are appended to, otherwise the
174 resulting archive might be unusable with non-GNU implementations of
175 \fBtar\fR. Notice also that when more than one archive is given, the
176 members from archives other than the first one will be accessible in
177 the resulting archive only if using the \fB\-i\fR
178 (\fB\-\-ignore\-zeros) option.
179
180 Compressed archives cannot be concatenated.
181 .TP
182 \fB\-c\fR, \fB\-\-create\fR
183 Create a new archive. Arguments supply the names of the files to be
184 archived. Directories are archived recursively, unless the
185 \fB\-\-no\-recursion\fR option is given.
186 .TP
187 \fB\-d\fR, \fB\-\-diff\fR, \fB\-\-compare\fR
188 Find differences between archive and file system. The arguments are
189 optional and specify archive members to compare. If not given, the
190 current working directory is assumed.
191 .TP
192 \fB\-\-delete\fR
193 Delete from the archive. The arguments supply names of the archive
194 members to be removed. At least one argument must be given.
195
196 This option does not operate on compressed archives. There is no
197 short option equivalent.
198 .TP
199 \fB\-r\fR, \fB\-\-append\fR
200 Append files to the end of an archive. Arguments have the same
201 meaning as for \fB\-c\fR (\fB\-\-create).
202 .TP
203 \fB\-t\fR, \fB\-\-list\fR
204 List the contents of an archive. Arguments are optional. When given,
205 they specify the names of the members to list.
206 .TP
207 \fB\-\-test\-label
208 Test the archive volume label and exit. When used without arguments,
209 it prints the volume label (if any) and exits with status \fB0\fR.
210 When one or more command line arguments are given.
211 .B tar
212 compares the volume label with each argument. It exits with code
213 \fB0\fR if a match is found, and with code \fB1\fR otherwise. No
214 output is displayed, unless used together with the \fB\-v\fR
215 (\fB\-\-verbose\fR) option.
216
217 There is no short option equivalent for this option.
218 .TP
219 \fB\-u\fR, \fB\-\-update\fR
220 Append files which are newer than the corresponding copy in the
221 archive. Arguments have the same meaning as with \fB\-c\fR and
222 \fB\-r\fR options.
223 .TP
224 \fB\-x\fR, \fB\-\-extract\fR, \fB\-\-get\fR
225 Extract files from an archive. Arguments are optional. When given,
226 they specify names of the archive members to be extracted.
227 .TP
228 .TP
229 \fB\-\-show\-defaults\fR
230 Show built-in defaults for various \fBtar\fR options and exit. No
231 arguments are allowed.
232 .TP
233 \fB\-?\fR, \fB\-\-help
234 Display a short option summary and exit. No arguments allowed.
235 .TP
236 \fB\-\-usage\fR
237 Display a list of available options and exit. No arguments allowed.
238 .TP
239 \fB\-\-version\fR
240 Print program version and copyright information and exit.
241 .SH OPTIONS
242 .SS Operation modifiers
243 .TP
244 \fB\-\-check\-device\fR
245 Check device numbers when creating incremental archives (default).
246 .TP
247 \fB\-g\fR, \fB\-\-listed\-incremental\fR=\fIFILE\fR
248 Handle new GNU-format incremental backups. \fIFILE\fR is the name of
249 a \fBsnapshot file\fR, where tar stores additional information which
250 is used to decide which files changed since the previous incremental
251 dump and, consequently, must be dumped again. If \fIFILE\fR does not
252 exist when creating an archive, it will be created and all files will
253 be added to the resulting archive (the \fBlevel 0\fR dump). To create
254 incremental archives of non-zero level \fBN\fR, create a copy of the
255 snapshot file created during the level \fBN-1\fR, and use it as
256 \fIFILE\fR.
257
258 When listing or extracting, the actual contents of \fIFILE\fR is not
259 inspected, it is needed only due to syntactical requirements. It is
260 therefore common practice to use \fB/dev/null\fR in its place.
261 .TP
262 \fB\-G\fR, \fB\-\-incremental\fR
263 Handle old GNU-format incremental backups.
264 .TP
265 \fB\-\-ignore\-failed\-read\fR
266 Do not exit with nonzero on unreadable files.
267 .TP
268 \fB\-\-level\fR=\fINUMBER\fR
269 Set dump level for created listed-incremental archive. Currently only
270 \fB\-\-level=0\fR is meaningful: it instructs \fBtar\fR to truncate
271 the snapshot file before dumping, thereby forcing a level 0 dump.
272 .TP
273 \fB\-n\fR, \fB\-\-seek\fR
274 Assume the archive is seekable. Normally \fBtar\fR determines
275 automatically whether the archive can be seeked or not. This option
276 is intended for use in cases when such recognition fails. It takes
277 effect only if the archive is open for reading (e.g. with
278 .B \-\-list
279 or
280 .B \-\-extract
281 options).
282 .TP
283 \fB\-\-no\-check\-device\fR
284 Do not check device numbers when creating incremental archives.
285 .TP
286 \fB\-\-no\-seek\fR
287 Assume the archive is not seekable.
288 .TP
289 \fB\-\-occurrence\fR[=\fIN\fR]
290 Process only the \fIN\fRth occurrence of each file in the
291 archive. This option is valid only when used with one of the
292 following subcommands: \fB\-\-delete\fR, \fB\-\-diff\fR,
293 \fB\-\-extract\fR or \fB\-\-list\fR and when a list of files is given
294 either on the command line or via the \fB\-\fRT option. The default
295 \fIN\fR is \fB1\fR.
296 .TP
297 \fB\-\-restrict\fR
298 Disable the use of some potentially harmful options.
299 .TP
300 \fB\-\-sparse\-version\fR=\fIMAJOR\fR[.\fIMINOR\fR]
301 Set version of the sparse format to use (implies \fB\-\-sparse\fR).
302 This option implies
303 .BR \-\-sparse .
304 Valid argument values are
305 .BR 0.0 ,
306 .BR 0.1 ", and"
307 .BR 1.0 .
308 For a detailed discussion of sparse formats, refer to the \fBGNU Tar
309 Manual\fR, appendix \fBD\fR, "\fBSparse Formats\fR". Using \fBinfo\fR
310 reader, it can be accessed running the following command:
311 .BR "info tar 'Sparse Formats'" .
312 .TP
313 \fB\-S\fR, \fB\-\-sparse\fR
314 Handle sparse files efficiently. Some files in the file system may
315 have segments which were actually never written (quite often these are
316 database files created by such systems as \fBDBM\fR). When given this
317 option, \fBtar\fR attempts to determine if the file is sparse prior to
318 archiving it, and if so, to reduce the resulting archive size by not
319 dumping empty parts of the file.
320 .SS Overwrite control
321 These options control \fBtar\fR actions when extracting a file over
322 an existing copy on disk.
323 .TP
324 \fB\-k\fR, \fB\-\-keep\-old\-files\fR
325 Don't replace existing files when extracting.
326 .TP
327 \fB\-\-keep\-newer\-files\fR
328 Don't replace existing files that are newer than their archive copies.
329 .TP
330 \fB\-\-no\-overwrite\-dir\fR
331 Preserve metadata of existing directories.
332 .TP
333 \fB\-\-overwrite\fR
334 Overwrite existing files when extracting.
335 .TP
336 \fB\-\-overwrite\-dir\fR
337 Overwrite metadata of existing directories when extracting (default).
338 .TP
339 \fB\-\-recursive\-unlink\fR
340 Recursively remove all files in the directory prior to extracting it.
341 .TP
342 \fB\-\-remove\-files\fR
343 Remove files from disk after adding them to the archive.
344 .TP
345 \fB\-U\fR, \fB\-\-unlink\-first\fR
346 Remove each file prior to extracting over it.
347 .TP
348 \fB\-W\fR, \fB\-\-verify\fR
349 Verify the archive after writing it.
350 .SS Output stream selection
351 .TP
352 \fB\-\-ignore\-command\-error\fR
353 .TP
354 Ignore subprocess exit codes.
355 .TP
356 \fB\-\-no\-ignore\-command\-error\fR
357 Treat non-zero exit codes of children as error (default).
358 .TP
359 \fB\-O\fR, \fB\-\-to\-stdout\fR
360 Extract files to standard output.
361 .TP
362 \fB\-\-to\-command\fR=\fICOMMAND\fR
363 Pipe extracted files to \fICOMMAND\fR. The argument is the pathname
364 of an external program, optionally with command line arguments. The
365 program will be invoked and the contents of the file being extracted
366 supplied to it on its standard output. Additional data will be
367 supplied via the following environment variables:
368 .RS
369 .TP
370 .B TAR_FILETYPE
371 Type of the file. It is a single letter with the following meaning:
372 .sp
373 .nf
374 .ta 8n 20n
375 f Regular file
376 d Directory
377 l Symbolic link
378 h Hard link
379 b Block device
380 c Character device
381 .fi
382
383 Currently only regular files are supported.
384 .TP
385 .B TAR_MODE
386 File mode, an octal number.
387 .TP
388 .B TAR_FILENAME
389 The name of the file.
390 .TP
391 .B TAR_REALNAME
392 Name of the file as stored in the archive.
393 .TP
394 .B TAR_UNAME
395 Name of the file owner.
396 .TP
397 .B TAR_GNAME
398 Name of the file owner group.
399 .TP
400 .B TAR_ATIME
401 Time of last access. It is a decimal number, representing seconds
402 since the Epoch. If the archive provides times with nanosecond
403 precision, the nanoseconds are appended to the timestamp after a
404 decimal point.
405 .TP
406 .B TAR_MTIME
407 Time of last modification.
408 .TP
409 .B TAR_CTIME
410 Time of last status change.
411 .TP
412 .B TAR_SIZE
413 Size of the file.
414 .TP
415 .B TAR_UID
416 UID of the file owner.
417 .TP
418 .B TAR_GID
419 GID of the file owner.
420 .RE
421 .RS
422
423 Additionally, the following variables contain information about
424 \fBtar\fR operation mode and the archive being processed:
425 .TP
426 .B TAR_VERSION
427 GNU \fBtar\fR version number.
428 .TP
429 .B TAR_ARCHIVE
430 The name of the archive \fBtar\fR is processing.
431 .TP
432 .B TAR_BLOCKING_FACTOR
433 Current blocking factor, i.e. number of 512-byte blocks in a record.
434 .TP
435 .B TAR_VOLUME
436 Ordinal number of the volume \fBtar\fR is processing (set if
437 reading a multi-volume archive).
438 .TP
439 .B TAR_FORMAT
440 Format of the archive being processed. One of:
441 .BR gnu ,
442 .BR oldgnu ,
443 .BR posix ,
444 .BR ustar ,
445 .BR v7 .
446 .B TAR_SUBCOMMAND
447 A short option (with a leading dash) describing the operation \fBtar\fR is
448 executing.
449 .RE
450 .SS Handling of file attributes
451 .TP
452 \fB\-\-atime\-preserve\fR[=\fIMETHOD\fR]
453 Preserve access times on dumped files, either by restoring the times
454 after reading (\fIMETHOD\fR=\fBreplace\fR, this is the default) or by
455 not setting the times in the first place (\fIMETHOD\fR=\fBsystem\fR)
456 .TP
457 \fB\-\-delay\-directory\-restore\fR
458 Delay setting modification times and permissions of extracted
459 directories until the end of extraction. Use this option when
460 extracting from an archive which has unusual member ordering.
461 .TP
462 \fB\-\-group\fR=\fINAME\fR
463 Force \fINAME\fR as group for added files.
464 .TP
465 \fB\-\-mode\fR=\fICHANGES\fR
466 Force symbolic mode \fICHANGES\fR for added files.
467 .TP
468 \fB\-\-mtime\fR=\fIDATE-OR-FILE\fR
469 Set mtime for added files. \fIDATE-OR-FILE\fR is either a date/time
470 in almost arbitrary formate, or the name of an existing file. In the
471 latter case the mtime of that file will be used.
472 .TP
473 \fB\-m\fR, \fB\-\-touch\fR
474 Don't extract file modified time.
475 .TP
476 \fB\-\-no\-delay\-directory\-restore\fR
477 Cancel the effect of the prior \fB\-\-delay\-directory\-restore\fR option.
478 .TP
479 \fB\-\-no\-same\-owner\fR
480 Extract files as yourself (default for ordinary users).
481 .TP
482 \fB\-\-no\-same\-permissions\fR
483 Apply the user's umask when extracting permissions from the archive
484 (default for ordinary users).
485 .TP
486 \fB\-\-numeric\-owner\fR
487 Always use numbers for user/group names.
488 .TP
489 \fB\-\-owner\fR=\fINAME\fR
490 Force \fINAME\fR as owner for added files.
491 .TP
492 \fB\-p\fR, \fB\-\-preserve\-permissions\fR, \fB\-\-same\-permissions\fR
493 extract information about file permissions (default for superuser)
494 .TP
495 \fB\-\-preserve\fR
496 Same as both \fB\-p\fR and \fB\-s\fR.
497 .TP
498 \fB\-\-same\-owner\fR
499 Try extracting files with the same ownership as exists in the archive
500 (default for superuser).
501 .TP
502 \fB\-s\fR, \fB\-\-preserve\-order\fR, \fB\-\-same\-order\fR
503 Sort names to extract to match archive
504 .SS Device selection and switching
505 .TP
506 \fB\-f\fR, \fB\-\-file\fR=\fIARCHIVE\fR
507 Use archive file or device \fIARCHIVE\fR. If this option is not
508 given, \fBtar\fR will first examine the environment variable `TAPE'.
509 If it is set, its value will be used as the archive name. Otherwise,
510 \fBtar\fR will assume the compiled-in default. The default
511 value can be inspected either using the
512 .B \-\-show\-defaults
513 option, or at the end of the \fBtar \-\-help\fR output.
514
515 An archive name that has a colon in it specifies a file or device on a
516 remote machine. The part before the colon is taken as the machine
517 name or IP address, and the part after it as the file or device
518 pathname, e.g.:
519
520 .EX
521 --file=remotehost:/dev/sr0
522 .EE
523
524 An optional username can be prefixed to the hostname, placing a \fB@\fR
525 sign between them.
526
527 By default, the remote host is accessed via the
528 .BR rsh (1)
529 command. Nowadays it is common to use
530 .BR ssh (1)
531 instead. You can do so by giving the following command line option:
532
533 .EX
534 --rsh-command=/usr/bin/ssh
535 .EE
536
537 The remote mashine should have the
538 .BR rmt (8)
539 command installed. If its pathname does not match \fBtar\fR's
540 default, you can inform \fBtar\fR about the correct pathname using the
541 .B \-\-rmt\-command
542 option.
543 .TP
544 \fB\-\-force\-local\fR
545 Archive file is local even if it has a colon.
546 .TP
547 \fB\-\fRF, \fB\-\-info\-script\fR=\fICOMMAND\fR, \fB\-\-new\-volume\-script\fR=\fICOMMAND\fR
548 Run \fICOMMAND\fR at the end of each tape (implies \fB\-M\fR). The
549 command can include arguments. When started, it will inherit \fBtar\fR's
550 environment plus the following variables:
551 .RS
552 .TP
553 .B TAR_VERSION
554 GNU \fBtar\fR version number.
555 .TP
556 .B TAR_ARCHIVE
557 The name of the archive \fBtar\fR is processing.
558 .TP
559 .B TAR_BLOCKING_FACTOR
560 Current blocking factor, i.e. number of 512-byte blocks in a record.
561 .TP
562 .B TAR_VOLUME
563 Ordinal number of the volume \fBtar\fR is processing (set if
564 reading a multi-volume archive).
565 .TP
566 .B TAR_FORMAT
567 Format of the archive being processed. One of:
568 .BR gnu ,
569 .BR oldgnu ,
570 .BR posix ,
571 .BR ustar ,
572 .BR v7 .
573 .TP
574 .B TAR_SUBCOMMAND
575 A short option (with a leading dash) describing the operation \fBtar\fR is
576 executing.
577 .TP
578 .B TAR_FD
579 File descriptor which can be used to communicate the new volume name
580 to
581 .BR tar .
582 .RE
583 .RS
584
585 If the info script fails, \fBtar\fR exits; otherwise, it begins writing
586 the next volume.
587 .RE
588 .TP
589 \fB\-L\fR, \fB\-\-tape\-length\fR=\fN\fR
590 Change tape after writing \fIN\fRx1024 bytes. If \fIN\fR is followed
591 by a size suffix (see the subsection
592 .B Size suffixes
593 below), the suffix specifies the multiplicative factor to be used
594 instead of 1024.
595
596 This option implies
597 .BR \-M .
598 .TP
599 \fB\-M\fR, \fB\-\-multi\-volume\fR
600 Create/list/extract multi-volume archive.
601 .TP
602 \fB\-\-rmt\-command\fR=\fICOMMAND\fR
603 Use \fICOMMAND\fR instead of \fBrmt\fR when accessing remote
604 archives. See the description of the
605 .B \-f
606 option, above.
607 .TP
608 \fB\-\-rsh\-command\fR=\fICOMMAND\fR
609 Use \fICOMMAND\fR instead of \fBrsh\fR when accessing remote
610 archives. See the description of the
611 .B \-f
612 option, above.
613 .TP
614 \fB\-\-volno\-file\fR=\fIFILE\fR
615 When this option is used in conjunction with
616 .BR \-\-multi\-volume ,
617 .B tar
618 will keep track of which volume of a multi-volume archive it is
619 working in \fIFILE\fR.
620 .SS Device blocking
621 .TP
622 \fB\-b\fR, \fB\-\-blocking\-factor\fR=\fIBLOCKS\fR
623 Set record size to \fIBLOCKS\fRx\fB512\fR bytes.
624 .TP
625 \fB\-B\fR, \fB\-\-read\-full\-records\fR
626 When listing or extracting, accept incomplete input records after
627 end-of-file marker.
628 .TP
629 \fB\-i\fR, \fB\-\-ignore\-zeros\fR
630 Ignore zeroed blocks in archive. Normally two consecutive 512-blocks
631 filled with zeroes mean EOF and tar stops reading after encountering
632 them. This option instructs it to read further and is useful when
633 reading archives created with the \fB\-A\fR option.
634 .TP
635 \fB\-\-record\-size\fR=\fINUMBER\fR
636 Set record size. \fINUMBER\fR is the number of bytes per record. It
637 must be multiple of \fB512\fR. It can can be suffixed with a \fBsize
638 suffix\fR, e.g. \fB\-\-record-size=10K\fR, for 10 Kilobytes. See the
639 subsection
640 .BR "Size suffixes" ,
641 for a list of valid suffixes.
642 .SS Archive format selection
643 .TP
644 \fB\-H\fR, \fB\-\-format\fR=\fIFORMAT\fR
645 Create archive of the given format. Valid formats are:
646 .RS
647 .TP
648 .B gnu
649 GNU tar 1.13.x format
650 .TP
651 .B oldgnu
652 GNU format as per tar <= 1.12.
653 .TP
654 \fBpax\fR, \fBposix\fR
655 POSIX 1003.1-2001 (pax) format.
656 .TP
657 .B ustar
658 POSIX 1003.1-1988 (ustar) format.
659 .TP
660 .B v7
661 Old V7 tar format.
662 .RE
663 .TP
664 \fB\-\-old\-archive\fR, \fB\-\-portability\fR
665 Same as \fB\-\-format=v7\fR.
666 .TP
667 \fB\-\-pax\-option\fR=\fIkeyword\fR[[:]=\fIvalue\fR][,\fIkeyword\fR[[:]=\fIvalue\fR]]...
668 Control pax keywords when creating \fBPAX\fR archives (\fB\-H
669 pax\fR). This option is equivalent to the \fB\-o\fR option of the
670 .BR pax (1) utility.
671 .TP
672 \fB\-\-posix\fR
673 Same as \fB\-\-format=posix\fR.
674 .TP
675 \fB\-V\fR, \fB\-\-label\fR=\fITEXT\fR
676 Create archive with volume name \fITEXT\fR. If listing or extracting,
677 use \fITEXT\fR as a globbing pattern for volume name.
678 .SS Compression options
679 .TP
680 \fB\-a\fR, \fB\-\-auto\-compress\fR
681 Use archive suffix to determine the compression program.
682 .TP
683 \fB\-\fRI, \fB\-\-use\-compress\-program\fI=\fICOMMAND\fR
684 Filter data through \fICOMMAND\fR. It must accept the \fB\-d\fR
685 option, for decompression. The argument can contain command line
686 options.
687 .TP
688 \fB\-j\fR, \fB\-\-bzip2\fR
689 Filter the archive through
690 .BR bzip2 (1).
691 .TP
692 \fB\-J\fR, \fB\-\-xz\fR
693 Filter the archive through
694 .BR xz (1).
695 .TP
696 \fB\-\-lzip\fR
697 Filter the archive through
698 .BR lzip (1).
699 .TP
700 \fB\-\-lzma\fR
701 Filter the archive through
702 .BR lzma (1).
703 .TP
704 \fB\-\-lzop\fR
705 Filter the archive through
706 .BR lzop (1).
707 .TP
708 \fB\-\-no\-auto\-compress\fR
709 Do not use archive suffix to determine the compression program.
710 .TP
711 \fB\-z\fR, \fB\-\-gzip\fR, \fB\-\-gunzip\fR, \fB\-\-ungzip\fR
712 Filter the archive through
713 .BR gzip (1).
714 .TP
715 \fB\-\fRZ, \fB\-\-compress\fR, \fB\-\-uncompress\fR
716 Filter the archive through
717 .BR compress (1).
718 .SS Local file selection
719 .TP
720 \fB\-\-add\-file\fR=\fIFILE\fR
721 Add \fIFILE\fR to the archive (useful if its name starts with a dash).
722 .TP
723 \fB\-\-backup\fR[=\fICONTROL\fR]
724 Backup before removal. The \fICONTROL\fR argument, if supplied,
725 controls the backup policy. Its valid values are:
726 .RS
727 .TP
728 .BR none ", " off
729 Never make backups.
730 .TP
731 .BR t ", " numbered
732 Make numbered backups.
733 .TP
734 .BR nil ", " existing
735 Make numbered backups if numbered backups exist, simple backups otherwise.
736 .TP
737 .BR never ", " simple
738 Always make simple backups
739 .RS
740 .RE
741
742 If \fICONTROL\fR is not given, the value is taken from the
743 .B VERSION_CONTROL
744 environment variable. If it is not set, \fBexisting\fR is assumed.
745 .RE
746 .TP
747 \fB\-C\fR, \fB\-\-directory\fR=\fIDIR\fR
748 Change to directory DIR.
749 .TP
750 \fB\-\-exclude\fR=\fIPATTERN\fR
751 Exclude files matching \fIPATTERN\fR, a
752 .BR glob (3)-style
753 wildcard pattern.
754 .TP
755 \fB\-\-exclude\-backups\fR
756 Exclude backup and lock files.
757 .TP
758 \fB\-\-exclude\-caches\fR
759 Exclude contents of directories containing file \fBCACHEDIR.TAG\fR,
760 except for the tag file itself.
761 .TP
762 \fB\-\-exclude\-caches\-all\fR
763 Exclude directories containing file \fBCACHEDIR.TAG\fR and the file itself.
764 .TP
765 \fB\-\-exclude\-caches\-under\fR
766 Exclude everything under directories containing \fBCACHEDIR.TAG\fR
767 .TP
768 \fB\-\-exclude\-tag\fR=\fIFILE\fR
769 Exclude contents of directories containing \fIFILE\fR, except for
770 \fIFILE\fR itself.
771 .TP
772 \fB\-\-exclude\-tag\-all\fR=\fIFILE\fR
773 Exclude directories containing \fIFILE\fR.
774 .TP
775 \fB\-\-exclude\-tag\-under\fR=\fIFILE\fR
776 Exclude everything under directories containing \fIFILE\fR.
777 .TP
778 \fB\-\-exclude\-vcs\fR
779 Exclude version control system directories.
780 .TP
781 \fB\-h\fR, \fB\-\-dereference\fR
782 Follow symlinks; archive and dump the files they point to.
783 .TP
784 \fB\-\-hard\-dereference\fR
785 Follow hard links; archive and dump the files they refer to.
786 .TP
787 \fB\-K\fR, \fB\-\-starting\-file\fR=\fIMEMBER\fR
788 Begin at the given member in the archive.
789 .TP
790 \fB\-\-newer\-mtime\fR=\fIDATE\fR
791 Work on files whose data changed after the \fIDATE\fR. If \fIDATE\fR
792 starts with \fB/\fR or \fB.\fR it is taken to be a file name; the
793 mtime of that file is used as the date.
794 .TP
795 \fB\-\-no\-null\fR
796 Disable the effect of the previous \fB\-\-null\fR option.
797 .TP
798 \fB\-\-no\-recursion\fR
799 Avoid descending automatically in directories.
800 .TP
801 \fB\-\-no\-unquote\fR
802 Do not unquote filenames read with \fB\-T\fR.
803 .TP
804 \fB\-\-null\fR
805 Instruct subsequent \fB\-T\fR options to read null-terminated names,
806 disable handling of the \fB\-C\fR option read from the file.
807 .TP
808 \fB\-N\fR, \fB\-\-newer\fR=\fIDATE\fR, \fB\-\-after\-date\fR=\fIDATE\fR
809 Only store files newer than DATE. If \fIDATE\fR starts with \fB/\fR
810 or \fB.\fR it is taken to be a file name; the ctime of that file is
811 used as the date.
812 .TP
813 \fB\-\-one\-file\-system\fR
814 Stay in local file system when creating archive.
815 .TP
816 \fB\-P\fR, \fB\-\-absolute\-names\fR
817 Don't strip leading slashes from file names when creating archives.
818 .TP
819 \fB\-\-recursion\fR
820 Recurse into directories (default).
821 .TP
822 \fB\-\-suffix\fR=\fISTRING\fR
823 Backup before removal, override usual suffix. Default suffix is \fB~\fR,
824 unless overridden by environment variable \fBSIMPLE_BACKUP_SUFFIX\fR.
825 .TP
826 \fB\-T\fR, \fB\-\-files\-from\fR=\fIFILE\fR
827 Get names to extract or create from \fIFILE\fR.
828 .TP
829 \fB\-\-unquote\fR
830 Unquote filenames read with \fB\-T\fR (default).
831 .TP
832 \fB\-X\fR, \fB\-\-exclude\-from\fR=\fIFILE\fR
833 Exclude files matching patterns listed in FILE.
834 .SS File name transformations
835 .TP
836 \fB\-\-strip\-components\fR=\fINUMBER\fR
837 Strip \fINUMBER\fR leading components from file names on extraction.
838 .TP
839 \fB\-\-transform\fR=\fIEXPRESSION\dR, \fB\-\-xform\fR=\fIEXPRESSION\fR
840 Use sed replace \fIEXPRESSION\fR to transform file names.
841 .SS File name matching options
842 These options affect both exclude and include patterns.
843 .TP
844 \fB\-\-anchored\fR
845 Patterns match file name start.
846 .TP
847 \fB\-\-ignore\-case\fR
848 Ignore case.
849 .TP
850 \fB\-\-no\-anchored\fR
851 Patterns match after any \fB/\fR (default for exclusion).
852 .TP
853 \fB\-\-no\-ignore\-case\fR
854 Case sensitive matching (default).
855 .TP
856 \fB\-\-no\-wildcards\fR
857 Verbatim string matching.
858 .TP
859 \fB\-\-no\-wildcards\-match\-slash\fR
860 Wildcards do not match \fB/\fR.
861 .TP
862 \fB\-\-wildcards\fR
863 Use wildcards (default for exclusion).
864 .TP
865 \fB\-\-wildcards\-match\-slash\fR
866 Wildcards match \fB/\fR (default for exclusion).
867 .SS Informative output
868 .TP
869 \fB\-\-checkpoint\fR[=\fIN\fR]
870 Display progress messages every \fIN\fRth record (default 10).
871 .TP
872 \fB\-\-checkpoint\-action\fR=\fIACTION\fR
873 Run \fIACTION\fR on each checkpoint.
874 .TP
875 \fB\-\-full\-time\fR
876 Print file time to its full resolution.
877 .TP
878 \fB\-\-index\-file\fR=\fIFILE\fR
879 Send verbose output to \fIFILE\fR.
880 .TP
881 \fB\-l\fR, \fB\-\-check\-links\fR
882 Print a message if not all links are dumped.
883 .TP
884 \fB\-\-no\-quote\-chars\fR=\fISTRING\fR
885 Disable quoting for characters from \fISTRING\fR.
886 .TP
887 \fB\-\-quote\-chars\fR=\fISTRING\fR
888 Additionally quote characters from \fISTRING\fR.
889 .TP
890 \fB\-\-quoting\-style\fR=\fISTYLE\fR
891 Set quoting style for file and member names. Valid values for
892 \fISTYLE\fR are
893 .BR literal ,
894 .BR shell ,
895 .BR shell-always ,
896 .BR c ,
897 .BR c-maybe ,
898 .BR escape ,
899 .BR locale ,
900 .BR clocale .
901 .TP
902 \fB\-R\fR, \fB\-\-block\-number\fR
903 Show block number within archive with each message.
904 .TP
905 \fB\-\-show\-omitted\-dirs\fR
906 When listing or extracting, list each directory that does not match
907 search criteria.
908 .TP
909 \fB\-\-show\-transformed\-names\fR, \fB\-\-show\-stored\-names\fR
910 Show file or archive names after transformation by \fB\-\-strip\fR and
911 \fB\-\-transform\fR options.
912 .TP
913 \fB\-\-totals\fR[=\fISIGNAL\fR]
914 Print total bytes after processing the archive. If \fISIGNAL\fR is
915 given, print total bytes when this signal is delivered. Allowed
916 signals are:
917 .BR SIGHUP ,
918 .BR SIGQUIT ,
919 .BR SIGINT ,
920 .BR SIGUSR1 ", and"
921 .BR SIGUSR2 .
922 The \fBSIG\fR prefix can be omitted.
923 .TP
924 \fB\-\-utc\fR
925 Print file modification times in UTC.
926 .TP
927 \fB\-v\fR, \fB\-\-verbose\fR
928 Verbosely list files processed.
929 .TP
930 \fB\-\-warning\fR=\fIKEYWORD\fR
931 Enable or disable warning messages identified by \fIKEYWORD\fR. The
932 messages are suppressed if \fIKEYWORD\fR is prefixed with \fBno\-\fR
933 and enabled otherwise.
934
935 Multiple \fB\-\-warning\fR messages accumulate.
936
937 Keywords controlling general \fBtar\fR operation:
938 .RS
939 .TP
940 .B all
941 Enable all warning messages. This is the default.
942 .TP
943 .B none
944 Disable all warning messages.
945 .TP
946 .B filename-with-nuls
947 "%s: file name read contains nul character"
948 .TP
949 .B alone-zero-block
950 "A lone zero block at %s"
951 .HP
952 Keywords applicable for \fBtar --create\fR:
953 .TP
954 .B cachedir
955 "%s: contains a cache directory tag %s; %s"
956 .TP
957 .B file-shrank
958 "%s: File shrank by %s bytes; padding with zeros"
959 .TP
960 .B xdev
961 "%s: file is on a different filesystem; not dumped"
962 .TP
963 .B file-ignored
964 "%s: Unknown file type; file ignored"
965 .br
966 "%s: socket ignored"
967 .br
968 "%s: door ignored"
969 .TP
970 .B file-unchanged
971 "%s: file is unchanged; not dumped"
972 .TP
973 .B ignore-archive
974 "%s: file is the archive; not dumped"
975 .TP
976 .B file-removed
977 "%s: File removed before we read it"
978 .TP
979 .B file-changed
980 "%s: file changed as we read it"
981 .HP
982 Keywords applicable for \fBtar --extract\fR:
983 .TP
984 .B timestamp
985 "%s: implausibly old time stamp %s"
986 .br
987 "%s: time stamp %s is %s s in the future"
988 .TP
989 .B contiguous-cast
990 "Extracting contiguous files as regular files"
991 .TP
992 .B symlink-cast
993 "Attempting extraction of symbolic links as hard links"
994 .TP
995 .B unknown-cast
996 "%s: Unknown file type '%c', extracted as normal file"
997 .TP
998 .B ignore-newer
999 "Current %s is newer or same age"
1000 .TP
1001 .B unknown-keyword
1002 "Ignoring unknown extended header keyword '%s'"
1003 .TP
1004 .B decompress-program
1005 Controls verbose description of failures occurring when trying to run
1006 alternative decompressor programs. This warning is disabled by
1007 default (unless \fB\-\-verbose\fR is used). A common example of what
1008 you can get when using this warning is:
1009
1010 .EX
1011 $ \fBtar --warning=decompress-program -x -f archive.Z
1012 tar (child): cannot run compress: No such file or directory
1013 tar (child): trying gzip
1014 .EE
1015
1016 This means that \fBtar\fR first tried to decompress
1017 \fBarchive.Z\fR using \fBcompress\fR, and, when that
1018 failed, switched to \fBgzip\fR.
1019 .TP
1020 .B record-size
1021 "Record size = %lu blocks"
1022 .HP
1023 Keywords controlling incremental extraction:
1024 .TP
1025 .B rename-directory
1026 "%s: Directory has been renamed from %s"
1027 .br
1028 "%s: Directory has been renamed"
1029 .TP
1030 .B new-directory
1031 "%s: Directory is new"
1032 .TP
1033 .B xdev
1034 "%s: directory is on a different device: not purging"
1035 .TP
1036 .B bad-dumpdir
1037 "Malformed dumpdir: 'X' never used"
1038 .RE
1039 .TP
1040 \fB\-w\fR, \fB\-\-interactive\fR, \fB\-\-confirmation\fR
1041 Ask for confirmation for every action.
1042 .SS Compatibility options
1043 .TP
1044 \fB\-o\fR
1045 When creating, same as \fB\-\-old\-archive\fR. When extracting, same
1046 as \fB\-\-no\-same\-owner\fR.
1047 .SS Size suffixes
1048 .sp
1049 .nf
1050 .ta 8n 18n 42n
1051 .ul
1052 Suffix Units Byte Equivalent
1053 b Blocks \fISIZE\fR x 512
1054 B Kilobytes \fISIZE\fR x 1024
1055 c Bytes \fISIZE\fR
1056 G Gigabytes \fISIZE\fR x 1024^3
1057 K Kilobytes \fISIZE\fR x 1024
1058 k Kilobytes \fISIZE\fR x 1024
1059 M Megabytes \fISIZE\fR x 1024^2
1060 P Petabytes \fISIZE\fR x 1024^5
1061 T Terabytes \fISIZE\fR x 1024^4
1062 w Words \fISIZE\fR x 2
1063 .fi
1064 .PP
1065 .SH "RETURN VALUE"
1066 Tar exit code indicates whether it was able to successfully perform
1067 the requested operation, and if not, what kind of error occurred.
1068 .TP
1069 .B 0
1070 Successful termination.
1071 .TP
1072 .B 1
1073 .I Some files differ.
1074 If tar was invoked with the \fB\-\-compare\fR (\fB\-\-diff\fR, \fB\-d\fR)
1075 command line option, this means that some files in the archive differ
1076 from their disk counterparts. If tar was given one of the \fB\-\-create\fR,
1077 \fB\-\-append\fR or \fB\-\-update\fR options, this exit code means
1078 that some files were changed while being archived and so the resulting
1079 archive does not contain the exact copy of the file set.
1080 .TP
1081 .B 2
1082 .I Fatal error.
1083 This means that some fatal, unrecoverable error occurred.
1084 .PP
1085 If a subprocess that had been invoked by
1086 .B tar
1087 exited with a nonzero exit code,
1088 .B tar
1089 itself exits with that code as well. This can happen, for example, if
1090 a compression option (e.g. \fB\-z\fR) was used and the external
1091 compressor program failed. Another example is
1092 .B rmt
1093 failure during backup to a remote device.
1094 .SH "SEE ALSO"
1095 .BR bzip2 (1),
1096 .BR compress (1),
1097 .BR gzip (1),
1098 .BR lzma (1),
1099 .BR lzop (1),
1100 .BR rmt (8),
1101 .BR symlink (7),
1102 .BR tar (5),
1103 .BR xz (1).
1104 .PP
1105 Complete \fBtar\fR manual: run
1106 .B info tar
1107 or use
1108 .BR emacs (1)
1109 info mode to read it.
1110 .PP
1111 Online copies of \fBGNU tar\fR documentation in various formats can be
1112 found at:
1113 .PP
1114 .in +4
1115 .B http://www.gnu.org/software/tar/manual
1116 .SH "BUG REPORTS"
1117 Report bugs to <bug\-tar@gnu.org>.
1118 .SH COPYRIGHT
1119 Copyright \(co 2013 Free Software Foundation, Inc.
1120 .br
1121 .na
1122 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
1123 .br
1124 .ad
1125 This is free software: you are free to change and redistribute it.
1126 There is NO WARRANTY, to the extent permitted by law.
1127 .\" Local variables:
1128 .\" eval: (add-hook 'write-file-hooks 'time-stamp)
1129 .\" time-stamp-start: ".TH [A-Z_][A-Z0-9_.\\-]* [0-9] \""
1130 .\" time-stamp-format: "%:B %:d, %:y"
1131 .\" time-stamp-end: "\""
1132 .\" time-stamp-line-limit: 20
1133 .\" end:
1134
This page took 0.081304 seconds and 4 git commands to generate.