]> Dogcows Code - chaz/tar/blob - doc/tar.1
Update copyright years.
[chaz/tar] / doc / tar.1
1 .\" This file is part of GNU tar. -*- nroff -*-
2 .\" Copyright 2013-2014 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 28, 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\-\-one\-top\-level\fR[\fB=\fIDIR\fR]
334 Extract all files into \fIDIR\fR, or, if used without argument, into a
335 subdirectory named by the base name of the archive (minus standard
336 compression suffixes recognizable by \fB\-\-auto\-compress).
337 .TP
338 \fB\-\-overwrite\fR
339 Overwrite existing files when extracting.
340 .TP
341 \fB\-\-overwrite\-dir\fR
342 Overwrite metadata of existing directories when extracting (default).
343 .TP
344 \fB\-\-recursive\-unlink\fR
345 Recursively remove all files in the directory prior to extracting it.
346 .TP
347 \fB\-\-remove\-files\fR
348 Remove files from disk after adding them to the archive.
349 .TP
350 \fB\-U\fR, \fB\-\-unlink\-first\fR
351 Remove each file prior to extracting over it.
352 .TP
353 \fB\-W\fR, \fB\-\-verify\fR
354 Verify the archive after writing it.
355 .SS Output stream selection
356 .TP
357 \fB\-\-ignore\-command\-error\fR
358 .TP
359 Ignore subprocess exit codes.
360 .TP
361 \fB\-\-no\-ignore\-command\-error\fR
362 Treat non-zero exit codes of children as error (default).
363 .TP
364 \fB\-O\fR, \fB\-\-to\-stdout\fR
365 Extract files to standard output.
366 .TP
367 \fB\-\-to\-command\fR=\fICOMMAND\fR
368 Pipe extracted files to \fICOMMAND\fR. The argument is the pathname
369 of an external program, optionally with command line arguments. The
370 program will be invoked and the contents of the file being extracted
371 supplied to it on its standard output. Additional data will be
372 supplied via the following environment variables:
373 .RS
374 .TP
375 .B TAR_FILETYPE
376 Type of the file. It is a single letter with the following meaning:
377 .sp
378 .nf
379 .ta 8n 20n
380 f Regular file
381 d Directory
382 l Symbolic link
383 h Hard link
384 b Block device
385 c Character device
386 .fi
387
388 Currently only regular files are supported.
389 .TP
390 .B TAR_MODE
391 File mode, an octal number.
392 .TP
393 .B TAR_FILENAME
394 The name of the file.
395 .TP
396 .B TAR_REALNAME
397 Name of the file as stored in the archive.
398 .TP
399 .B TAR_UNAME
400 Name of the file owner.
401 .TP
402 .B TAR_GNAME
403 Name of the file owner group.
404 .TP
405 .B TAR_ATIME
406 Time of last access. It is a decimal number, representing seconds
407 since the Epoch. If the archive provides times with nanosecond
408 precision, the nanoseconds are appended to the timestamp after a
409 decimal point.
410 .TP
411 .B TAR_MTIME
412 Time of last modification.
413 .TP
414 .B TAR_CTIME
415 Time of last status change.
416 .TP
417 .B TAR_SIZE
418 Size of the file.
419 .TP
420 .B TAR_UID
421 UID of the file owner.
422 .TP
423 .B TAR_GID
424 GID of the file owner.
425 .RE
426 .RS
427
428 Additionally, the following variables contain information about
429 \fBtar\fR operation mode and the archive being processed:
430 .TP
431 .B TAR_VERSION
432 GNU \fBtar\fR version number.
433 .TP
434 .B TAR_ARCHIVE
435 The name of the archive \fBtar\fR is processing.
436 .TP
437 .B TAR_BLOCKING_FACTOR
438 Current blocking factor, i.e. number of 512-byte blocks in a record.
439 .TP
440 .B TAR_VOLUME
441 Ordinal number of the volume \fBtar\fR is processing (set if
442 reading a multi-volume archive).
443 .TP
444 .B TAR_FORMAT
445 Format of the archive being processed. One of:
446 .BR gnu ,
447 .BR oldgnu ,
448 .BR posix ,
449 .BR ustar ,
450 .BR v7 .
451 .B TAR_SUBCOMMAND
452 A short option (with a leading dash) describing the operation \fBtar\fR is
453 executing.
454 .RE
455 .SS Handling of file attributes
456 .TP
457 \fB\-\-atime\-preserve\fR[=\fIMETHOD\fR]
458 Preserve access times on dumped files, either by restoring the times
459 after reading (\fIMETHOD\fR=\fBreplace\fR, this is the default) or by
460 not setting the times in the first place (\fIMETHOD\fR=\fBsystem\fR)
461 .TP
462 \fB\-\-delay\-directory\-restore\fR
463 Delay setting modification times and permissions of extracted
464 directories until the end of extraction. Use this option when
465 extracting from an archive which has unusual member ordering.
466 .TP
467 \fB\-\-group\fR=\fINAME\fR
468 Force \fINAME\fR as group for added files.
469 .TP
470 \fB\-\-mode\fR=\fICHANGES\fR
471 Force symbolic mode \fICHANGES\fR for added files.
472 .TP
473 \fB\-\-mtime\fR=\fIDATE-OR-FILE\fR
474 Set mtime for added files. \fIDATE-OR-FILE\fR is either a date/time
475 in almost arbitrary formate, or the name of an existing file. In the
476 latter case the mtime of that file will be used.
477 .TP
478 \fB\-m\fR, \fB\-\-touch\fR
479 Don't extract file modified time.
480 .TP
481 \fB\-\-no\-delay\-directory\-restore\fR
482 Cancel the effect of the prior \fB\-\-delay\-directory\-restore\fR option.
483 .TP
484 \fB\-\-no\-same\-owner\fR
485 Extract files as yourself (default for ordinary users).
486 .TP
487 \fB\-\-no\-same\-permissions\fR
488 Apply the user's umask when extracting permissions from the archive
489 (default for ordinary users).
490 .TP
491 \fB\-\-numeric\-owner\fR
492 Always use numbers for user/group names.
493 .TP
494 \fB\-\-owner\fR=\fINAME\fR
495 Force \fINAME\fR as owner for added files.
496 .TP
497 \fB\-p\fR, \fB\-\-preserve\-permissions\fR, \fB\-\-same\-permissions\fR
498 extract information about file permissions (default for superuser)
499 .TP
500 \fB\-\-preserve\fR
501 Same as both \fB\-p\fR and \fB\-s\fR.
502 .TP
503 \fB\-\-same\-owner\fR
504 Try extracting files with the same ownership as exists in the archive
505 (default for superuser).
506 .TP
507 \fB\-s\fR, \fB\-\-preserve\-order\fR, \fB\-\-same\-order\fR
508 Sort names to extract to match archive
509 .SS Device selection and switching
510 .TP
511 \fB\-f\fR, \fB\-\-file\fR=\fIARCHIVE\fR
512 Use archive file or device \fIARCHIVE\fR. If this option is not
513 given, \fBtar\fR will first examine the environment variable `TAPE'.
514 If it is set, its value will be used as the archive name. Otherwise,
515 \fBtar\fR will assume the compiled-in default. The default
516 value can be inspected either using the
517 .B \-\-show\-defaults
518 option, or at the end of the \fBtar \-\-help\fR output.
519
520 An archive name that has a colon in it specifies a file or device on a
521 remote machine. The part before the colon is taken as the machine
522 name or IP address, and the part after it as the file or device
523 pathname, e.g.:
524
525 .EX
526 --file=remotehost:/dev/sr0
527 .EE
528
529 An optional username can be prefixed to the hostname, placing a \fB@\fR
530 sign between them.
531
532 By default, the remote host is accessed via the
533 .BR rsh (1)
534 command. Nowadays it is common to use
535 .BR ssh (1)
536 instead. You can do so by giving the following command line option:
537
538 .EX
539 --rsh-command=/usr/bin/ssh
540 .EE
541
542 The remote mashine should have the
543 .BR rmt (8)
544 command installed. If its pathname does not match \fBtar\fR's
545 default, you can inform \fBtar\fR about the correct pathname using the
546 .B \-\-rmt\-command
547 option.
548 .TP
549 \fB\-\-force\-local\fR
550 Archive file is local even if it has a colon.
551 .TP
552 \fB\-\fRF, \fB\-\-info\-script\fR=\fICOMMAND\fR, \fB\-\-new\-volume\-script\fR=\fICOMMAND\fR
553 Run \fICOMMAND\fR at the end of each tape (implies \fB\-M\fR). The
554 command can include arguments. When started, it will inherit \fBtar\fR's
555 environment plus the following variables:
556 .RS
557 .TP
558 .B TAR_VERSION
559 GNU \fBtar\fR version number.
560 .TP
561 .B TAR_ARCHIVE
562 The name of the archive \fBtar\fR is processing.
563 .TP
564 .B TAR_BLOCKING_FACTOR
565 Current blocking factor, i.e. number of 512-byte blocks in a record.
566 .TP
567 .B TAR_VOLUME
568 Ordinal number of the volume \fBtar\fR is processing (set if
569 reading a multi-volume archive).
570 .TP
571 .B TAR_FORMAT
572 Format of the archive being processed. One of:
573 .BR gnu ,
574 .BR oldgnu ,
575 .BR posix ,
576 .BR ustar ,
577 .BR v7 .
578 .TP
579 .B TAR_SUBCOMMAND
580 A short option (with a leading dash) describing the operation \fBtar\fR is
581 executing.
582 .TP
583 .B TAR_FD
584 File descriptor which can be used to communicate the new volume name
585 to
586 .BR tar .
587 .RE
588 .RS
589
590 If the info script fails, \fBtar\fR exits; otherwise, it begins writing
591 the next volume.
592 .RE
593 .TP
594 \fB\-L\fR, \fB\-\-tape\-length\fR=\fN\fR
595 Change tape after writing \fIN\fRx1024 bytes. If \fIN\fR is followed
596 by a size suffix (see the subsection
597 .B Size suffixes
598 below), the suffix specifies the multiplicative factor to be used
599 instead of 1024.
600
601 This option implies
602 .BR \-M .
603 .TP
604 \fB\-M\fR, \fB\-\-multi\-volume\fR
605 Create/list/extract multi-volume archive.
606 .TP
607 \fB\-\-rmt\-command\fR=\fICOMMAND\fR
608 Use \fICOMMAND\fR instead of \fBrmt\fR when accessing remote
609 archives. See the description of the
610 .B \-f
611 option, above.
612 .TP
613 \fB\-\-rsh\-command\fR=\fICOMMAND\fR
614 Use \fICOMMAND\fR instead of \fBrsh\fR when accessing remote
615 archives. See the description of the
616 .B \-f
617 option, above.
618 .TP
619 \fB\-\-volno\-file\fR=\fIFILE\fR
620 When this option is used in conjunction with
621 .BR \-\-multi\-volume ,
622 .B tar
623 will keep track of which volume of a multi-volume archive it is
624 working in \fIFILE\fR.
625 .SS Device blocking
626 .TP
627 \fB\-b\fR, \fB\-\-blocking\-factor\fR=\fIBLOCKS\fR
628 Set record size to \fIBLOCKS\fRx\fB512\fR bytes.
629 .TP
630 \fB\-B\fR, \fB\-\-read\-full\-records\fR
631 When listing or extracting, accept incomplete input records after
632 end-of-file marker.
633 .TP
634 \fB\-i\fR, \fB\-\-ignore\-zeros\fR
635 Ignore zeroed blocks in archive. Normally two consecutive 512-blocks
636 filled with zeroes mean EOF and tar stops reading after encountering
637 them. This option instructs it to read further and is useful when
638 reading archives created with the \fB\-A\fR option.
639 .TP
640 \fB\-\-record\-size\fR=\fINUMBER\fR
641 Set record size. \fINUMBER\fR is the number of bytes per record. It
642 must be multiple of \fB512\fR. It can can be suffixed with a \fBsize
643 suffix\fR, e.g. \fB\-\-record-size=10K\fR, for 10 Kilobytes. See the
644 subsection
645 .BR "Size suffixes" ,
646 for a list of valid suffixes.
647 .SS Archive format selection
648 .TP
649 \fB\-H\fR, \fB\-\-format\fR=\fIFORMAT\fR
650 Create archive of the given format. Valid formats are:
651 .RS
652 .TP
653 .B gnu
654 GNU tar 1.13.x format
655 .TP
656 .B oldgnu
657 GNU format as per tar <= 1.12.
658 .TP
659 \fBpax\fR, \fBposix\fR
660 POSIX 1003.1-2001 (pax) format.
661 .TP
662 .B ustar
663 POSIX 1003.1-1988 (ustar) format.
664 .TP
665 .B v7
666 Old V7 tar format.
667 .RE
668 .TP
669 \fB\-\-old\-archive\fR, \fB\-\-portability\fR
670 Same as \fB\-\-format=v7\fR.
671 .TP
672 \fB\-\-pax\-option\fR=\fIkeyword\fR[[:]=\fIvalue\fR][,\fIkeyword\fR[[:]=\fIvalue\fR]]...
673 Control pax keywords when creating \fBPAX\fR archives (\fB\-H
674 pax\fR). This option is equivalent to the \fB\-o\fR option of the
675 .BR pax (1) utility.
676 .TP
677 \fB\-\-posix\fR
678 Same as \fB\-\-format=posix\fR.
679 .TP
680 \fB\-V\fR, \fB\-\-label\fR=\fITEXT\fR
681 Create archive with volume name \fITEXT\fR. If listing or extracting,
682 use \fITEXT\fR as a globbing pattern for volume name.
683 .SS Compression options
684 .TP
685 \fB\-a\fR, \fB\-\-auto\-compress\fR
686 Use archive suffix to determine the compression program.
687 .TP
688 \fB\-\fRI, \fB\-\-use\-compress\-program\fI=\fICOMMAND\fR
689 Filter data through \fICOMMAND\fR. It must accept the \fB\-d\fR
690 option, for decompression. The argument can contain command line
691 options.
692 .TP
693 \fB\-j\fR, \fB\-\-bzip2\fR
694 Filter the archive through
695 .BR bzip2 (1).
696 .TP
697 \fB\-J\fR, \fB\-\-xz\fR
698 Filter the archive through
699 .BR xz (1).
700 .TP
701 \fB\-\-lzip\fR
702 Filter the archive through
703 .BR lzip (1).
704 .TP
705 \fB\-\-lzma\fR
706 Filter the archive through
707 .BR lzma (1).
708 .TP
709 \fB\-\-lzop\fR
710 Filter the archive through
711 .BR lzop (1).
712 .TP
713 \fB\-\-no\-auto\-compress\fR
714 Do not use archive suffix to determine the compression program.
715 .TP
716 \fB\-z\fR, \fB\-\-gzip\fR, \fB\-\-gunzip\fR, \fB\-\-ungzip\fR
717 Filter the archive through
718 .BR gzip (1).
719 .TP
720 \fB\-\fRZ, \fB\-\-compress\fR, \fB\-\-uncompress\fR
721 Filter the archive through
722 .BR compress (1).
723 .SS Local file selection
724 .TP
725 \fB\-\-add\-file\fR=\fIFILE\fR
726 Add \fIFILE\fR to the archive (useful if its name starts with a dash).
727 .TP
728 \fB\-\-backup\fR[=\fICONTROL\fR]
729 Backup before removal. The \fICONTROL\fR argument, if supplied,
730 controls the backup policy. Its valid values are:
731 .RS
732 .TP
733 .BR none ", " off
734 Never make backups.
735 .TP
736 .BR t ", " numbered
737 Make numbered backups.
738 .TP
739 .BR nil ", " existing
740 Make numbered backups if numbered backups exist, simple backups otherwise.
741 .TP
742 .BR never ", " simple
743 Always make simple backups
744 .RS
745 .RE
746
747 If \fICONTROL\fR is not given, the value is taken from the
748 .B VERSION_CONTROL
749 environment variable. If it is not set, \fBexisting\fR is assumed.
750 .RE
751 .TP
752 \fB\-C\fR, \fB\-\-directory\fR=\fIDIR\fR
753 Change to directory DIR.
754 .TP
755 \fB\-\-exclude\fR=\fIPATTERN\fR
756 Exclude files matching \fIPATTERN\fR, a
757 .BR glob (3)-style
758 wildcard pattern.
759 .TP
760 \fB\-\-exclude\-backups\fR
761 Exclude backup and lock files.
762 .TP
763 \fB\-\-exclude\-caches\fR
764 Exclude contents of directories containing file \fBCACHEDIR.TAG\fR,
765 except for the tag file itself.
766 .TP
767 \fB\-\-exclude\-caches\-all\fR
768 Exclude directories containing file \fBCACHEDIR.TAG\fR and the file itself.
769 .TP
770 \fB\-\-exclude\-caches\-under\fR
771 Exclude everything under directories containing \fBCACHEDIR.TAG\fR
772 .TP
773 \fB\-\-exclude\-tag\fR=\fIFILE\fR
774 Exclude contents of directories containing \fIFILE\fR, except for
775 \fIFILE\fR itself.
776 .TP
777 \fB\-\-exclude\-tag\-all\fR=\fIFILE\fR
778 Exclude directories containing \fIFILE\fR.
779 .TP
780 \fB\-\-exclude\-tag\-under\fR=\fIFILE\fR
781 Exclude everything under directories containing \fIFILE\fR.
782 .TP
783 \fB\-\-exclude\-vcs\fR
784 Exclude version control system directories.
785 .TP
786 \fB\-h\fR, \fB\-\-dereference\fR
787 Follow symlinks; archive and dump the files they point to.
788 .TP
789 \fB\-\-hard\-dereference\fR
790 Follow hard links; archive and dump the files they refer to.
791 .TP
792 \fB\-K\fR, \fB\-\-starting\-file\fR=\fIMEMBER\fR
793 Begin at the given member in the archive.
794 .TP
795 \fB\-\-newer\-mtime\fR=\fIDATE\fR
796 Work on files whose data changed after the \fIDATE\fR. If \fIDATE\fR
797 starts with \fB/\fR or \fB.\fR it is taken to be a file name; the
798 mtime of that file is used as the date.
799 .TP
800 \fB\-\-no\-null\fR
801 Disable the effect of the previous \fB\-\-null\fR option.
802 .TP
803 \fB\-\-no\-recursion\fR
804 Avoid descending automatically in directories.
805 .TP
806 \fB\-\-no\-unquote\fR
807 Do not unquote filenames read with \fB\-T\fR.
808 .TP
809 \fB\-\-null\fR
810 Instruct subsequent \fB\-T\fR options to read null-terminated names,
811 disable handling of the \fB\-C\fR option read from the file.
812 .TP
813 \fB\-N\fR, \fB\-\-newer\fR=\fIDATE\fR, \fB\-\-after\-date\fR=\fIDATE\fR
814 Only store files newer than DATE. If \fIDATE\fR starts with \fB/\fR
815 or \fB.\fR it is taken to be a file name; the ctime of that file is
816 used as the date.
817 .TP
818 \fB\-\-one\-file\-system\fR
819 Stay in local file system when creating archive.
820 .TP
821 \fB\-P\fR, \fB\-\-absolute\-names\fR
822 Don't strip leading slashes from file names when creating archives.
823 .TP
824 \fB\-\-recursion\fR
825 Recurse into directories (default).
826 .TP
827 \fB\-\-suffix\fR=\fISTRING\fR
828 Backup before removal, override usual suffix. Default suffix is \fB~\fR,
829 unless overridden by environment variable \fBSIMPLE_BACKUP_SUFFIX\fR.
830 .TP
831 \fB\-T\fR, \fB\-\-files\-from\fR=\fIFILE\fR
832 Get names to extract or create from \fIFILE\fR.
833 .TP
834 \fB\-\-unquote\fR
835 Unquote filenames read with \fB\-T\fR (default).
836 .TP
837 \fB\-X\fR, \fB\-\-exclude\-from\fR=\fIFILE\fR
838 Exclude files matching patterns listed in FILE.
839 .SS File name transformations
840 .TP
841 \fB\-\-strip\-components\fR=\fINUMBER\fR
842 Strip \fINUMBER\fR leading components from file names on extraction.
843 .TP
844 \fB\-\-transform\fR=\fIEXPRESSION\dR, \fB\-\-xform\fR=\fIEXPRESSION\fR
845 Use sed replace \fIEXPRESSION\fR to transform file names.
846 .SS File name matching options
847 These options affect both exclude and include patterns.
848 .TP
849 \fB\-\-anchored\fR
850 Patterns match file name start.
851 .TP
852 \fB\-\-ignore\-case\fR
853 Ignore case.
854 .TP
855 \fB\-\-no\-anchored\fR
856 Patterns match after any \fB/\fR (default for exclusion).
857 .TP
858 \fB\-\-no\-ignore\-case\fR
859 Case sensitive matching (default).
860 .TP
861 \fB\-\-no\-wildcards\fR
862 Verbatim string matching.
863 .TP
864 \fB\-\-no\-wildcards\-match\-slash\fR
865 Wildcards do not match \fB/\fR.
866 .TP
867 \fB\-\-wildcards\fR
868 Use wildcards (default for exclusion).
869 .TP
870 \fB\-\-wildcards\-match\-slash\fR
871 Wildcards match \fB/\fR (default for exclusion).
872 .SS Informative output
873 .TP
874 \fB\-\-checkpoint\fR[=\fIN\fR]
875 Display progress messages every \fIN\fRth record (default 10).
876 .TP
877 \fB\-\-checkpoint\-action\fR=\fIACTION\fR
878 Run \fIACTION\fR on each checkpoint.
879 .TP
880 \fB\-\-full\-time\fR
881 Print file time to its full resolution.
882 .TP
883 \fB\-\-index\-file\fR=\fIFILE\fR
884 Send verbose output to \fIFILE\fR.
885 .TP
886 \fB\-l\fR, \fB\-\-check\-links\fR
887 Print a message if not all links are dumped.
888 .TP
889 \fB\-\-no\-quote\-chars\fR=\fISTRING\fR
890 Disable quoting for characters from \fISTRING\fR.
891 .TP
892 \fB\-\-quote\-chars\fR=\fISTRING\fR
893 Additionally quote characters from \fISTRING\fR.
894 .TP
895 \fB\-\-quoting\-style\fR=\fISTYLE\fR
896 Set quoting style for file and member names. Valid values for
897 \fISTYLE\fR are
898 .BR literal ,
899 .BR shell ,
900 .BR shell-always ,
901 .BR c ,
902 .BR c-maybe ,
903 .BR escape ,
904 .BR locale ,
905 .BR clocale .
906 .TP
907 \fB\-R\fR, \fB\-\-block\-number\fR
908 Show block number within archive with each message.
909 .TP
910 \fB\-\-show\-omitted\-dirs\fR
911 When listing or extracting, list each directory that does not match
912 search criteria.
913 .TP
914 \fB\-\-show\-transformed\-names\fR, \fB\-\-show\-stored\-names\fR
915 Show file or archive names after transformation by \fB\-\-strip\fR and
916 \fB\-\-transform\fR options.
917 .TP
918 \fB\-\-totals\fR[=\fISIGNAL\fR]
919 Print total bytes after processing the archive. If \fISIGNAL\fR is
920 given, print total bytes when this signal is delivered. Allowed
921 signals are:
922 .BR SIGHUP ,
923 .BR SIGQUIT ,
924 .BR SIGINT ,
925 .BR SIGUSR1 ", and"
926 .BR SIGUSR2 .
927 The \fBSIG\fR prefix can be omitted.
928 .TP
929 \fB\-\-utc\fR
930 Print file modification times in UTC.
931 .TP
932 \fB\-v\fR, \fB\-\-verbose\fR
933 Verbosely list files processed.
934 .TP
935 \fB\-\-warning\fR=\fIKEYWORD\fR
936 Enable or disable warning messages identified by \fIKEYWORD\fR. The
937 messages are suppressed if \fIKEYWORD\fR is prefixed with \fBno\-\fR
938 and enabled otherwise.
939
940 Multiple \fB\-\-warning\fR messages accumulate.
941
942 Keywords controlling general \fBtar\fR operation:
943 .RS
944 .TP
945 .B all
946 Enable all warning messages. This is the default.
947 .TP
948 .B none
949 Disable all warning messages.
950 .TP
951 .B filename-with-nuls
952 "%s: file name read contains nul character"
953 .TP
954 .B alone-zero-block
955 "A lone zero block at %s"
956 .HP
957 Keywords applicable for \fBtar --create\fR:
958 .TP
959 .B cachedir
960 "%s: contains a cache directory tag %s; %s"
961 .TP
962 .B file-shrank
963 "%s: File shrank by %s bytes; padding with zeros"
964 .TP
965 .B xdev
966 "%s: file is on a different filesystem; not dumped"
967 .TP
968 .B file-ignored
969 "%s: Unknown file type; file ignored"
970 .br
971 "%s: socket ignored"
972 .br
973 "%s: door ignored"
974 .TP
975 .B file-unchanged
976 "%s: file is unchanged; not dumped"
977 .TP
978 .B ignore-archive
979 "%s: file is the archive; not dumped"
980 .TP
981 .B file-removed
982 "%s: File removed before we read it"
983 .TP
984 .B file-changed
985 "%s: file changed as we read it"
986 .HP
987 Keywords applicable for \fBtar --extract\fR:
988 .TP
989 .B timestamp
990 "%s: implausibly old time stamp %s"
991 .br
992 "%s: time stamp %s is %s s in the future"
993 .TP
994 .B contiguous-cast
995 "Extracting contiguous files as regular files"
996 .TP
997 .B symlink-cast
998 "Attempting extraction of symbolic links as hard links"
999 .TP
1000 .B unknown-cast
1001 "%s: Unknown file type '%c', extracted as normal file"
1002 .TP
1003 .B ignore-newer
1004 "Current %s is newer or same age"
1005 .TP
1006 .B unknown-keyword
1007 "Ignoring unknown extended header keyword '%s'"
1008 .TP
1009 .B decompress-program
1010 Controls verbose description of failures occurring when trying to run
1011 alternative decompressor programs. This warning is disabled by
1012 default (unless \fB\-\-verbose\fR is used). A common example of what
1013 you can get when using this warning is:
1014
1015 .EX
1016 $ \fBtar --warning=decompress-program -x -f archive.Z
1017 tar (child): cannot run compress: No such file or directory
1018 tar (child): trying gzip
1019 .EE
1020
1021 This means that \fBtar\fR first tried to decompress
1022 \fBarchive.Z\fR using \fBcompress\fR, and, when that
1023 failed, switched to \fBgzip\fR.
1024 .TP
1025 .B record-size
1026 "Record size = %lu blocks"
1027 .HP
1028 Keywords controlling incremental extraction:
1029 .TP
1030 .B rename-directory
1031 "%s: Directory has been renamed from %s"
1032 .br
1033 "%s: Directory has been renamed"
1034 .TP
1035 .B new-directory
1036 "%s: Directory is new"
1037 .TP
1038 .B xdev
1039 "%s: directory is on a different device: not purging"
1040 .TP
1041 .B bad-dumpdir
1042 "Malformed dumpdir: 'X' never used"
1043 .RE
1044 .TP
1045 \fB\-w\fR, \fB\-\-interactive\fR, \fB\-\-confirmation\fR
1046 Ask for confirmation for every action.
1047 .SS Compatibility options
1048 .TP
1049 \fB\-o\fR
1050 When creating, same as \fB\-\-old\-archive\fR. When extracting, same
1051 as \fB\-\-no\-same\-owner\fR.
1052 .SS Size suffixes
1053 .sp
1054 .nf
1055 .ta 8n 18n 42n
1056 .ul
1057 Suffix Units Byte Equivalent
1058 b Blocks \fISIZE\fR x 512
1059 B Kilobytes \fISIZE\fR x 1024
1060 c Bytes \fISIZE\fR
1061 G Gigabytes \fISIZE\fR x 1024^3
1062 K Kilobytes \fISIZE\fR x 1024
1063 k Kilobytes \fISIZE\fR x 1024
1064 M Megabytes \fISIZE\fR x 1024^2
1065 P Petabytes \fISIZE\fR x 1024^5
1066 T Terabytes \fISIZE\fR x 1024^4
1067 w Words \fISIZE\fR x 2
1068 .fi
1069 .PP
1070 .SH "RETURN VALUE"
1071 Tar exit code indicates whether it was able to successfully perform
1072 the requested operation, and if not, what kind of error occurred.
1073 .TP
1074 .B 0
1075 Successful termination.
1076 .TP
1077 .B 1
1078 .I Some files differ.
1079 If tar was invoked with the \fB\-\-compare\fR (\fB\-\-diff\fR, \fB\-d\fR)
1080 command line option, this means that some files in the archive differ
1081 from their disk counterparts. If tar was given one of the \fB\-\-create\fR,
1082 \fB\-\-append\fR or \fB\-\-update\fR options, this exit code means
1083 that some files were changed while being archived and so the resulting
1084 archive does not contain the exact copy of the file set.
1085 .TP
1086 .B 2
1087 .I Fatal error.
1088 This means that some fatal, unrecoverable error occurred.
1089 .PP
1090 If a subprocess that had been invoked by
1091 .B tar
1092 exited with a nonzero exit code,
1093 .B tar
1094 itself exits with that code as well. This can happen, for example, if
1095 a compression option (e.g. \fB\-z\fR) was used and the external
1096 compressor program failed. Another example is
1097 .B rmt
1098 failure during backup to a remote device.
1099 .SH "SEE ALSO"
1100 .BR bzip2 (1),
1101 .BR compress (1),
1102 .BR gzip (1),
1103 .BR lzma (1),
1104 .BR lzop (1),
1105 .BR rmt (8),
1106 .BR symlink (7),
1107 .BR tar (5),
1108 .BR xz (1).
1109 .PP
1110 Complete \fBtar\fR manual: run
1111 .B info tar
1112 or use
1113 .BR emacs (1)
1114 info mode to read it.
1115 .PP
1116 Online copies of \fBGNU tar\fR documentation in various formats can be
1117 found at:
1118 .PP
1119 .in +4
1120 .B http://www.gnu.org/software/tar/manual
1121 .SH "BUG REPORTS"
1122 Report bugs to <bug\-tar@gnu.org>.
1123 .SH COPYRIGHT
1124 Copyright \(co 2013 Free Software Foundation, Inc.
1125 .br
1126 .na
1127 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
1128 .br
1129 .ad
1130 This is free software: you are free to change and redistribute it.
1131 There is NO WARRANTY, to the extent permitted by law.
1132 .\" Local variables:
1133 .\" eval: (add-hook 'write-file-hooks 'time-stamp)
1134 .\" time-stamp-start: ".TH [A-Z_][A-Z0-9_.\\-]* [0-9] \""
1135 .\" time-stamp-format: "%:B %:d, %:y"
1136 .\" time-stamp-end: "\""
1137 .\" time-stamp-line-limit: 20
1138 .\" end:
1139
This page took 0.077433 seconds and 4 git commands to generate.