1TAR(1)                          GNU TAR Manual                          TAR(1)
2
3
4

NAME

6       tar - an archiving utility
7

SYNOPSIS

9   Traditional usage
10       tar {A|c|d|r|t|u|x}[GnSkUWOmpsMBiajJzZhPlRvwo] [ARG...]
11
12   UNIX-style usage
13       tar -A [OPTIONS] ARCHIVE ARCHIVE
14
15       tar -c [-f ARCHIVE] [OPTIONS] [FILE...]
16
17       tar -d [-f ARCHIVE] [OPTIONS] [FILE...]
18
19       tar -t [-f ARCHIVE] [OPTIONS] [MEMBER...]
20
21       tar -r [-f ARCHIVE] [OPTIONS] [FILE...]
22
23       tar -u [-f ARCHIVE] [OPTIONS] [FILE...]
24
25       tar -x [-f ARCHIVE] [OPTIONS] [MEMBER...]
26
27   GNU-style usage
28       tar {--catenate|--concatenate} [OPTIONS] ARCHIVE ARCHIVE
29
30       tar --create [--file ARCHIVE] [OPTIONS] [FILE...]
31
32       tar {--diff|--compare} [--file ARCHIVE] [OPTIONS] [FILE...]
33
34       tar --delete [--file ARCHIVE] [OPTIONS] [MEMBER...]
35
36       tar --append [-f ARCHIVE] [OPTIONS] [FILE...]
37
38       tar --list [-f ARCHIVE] [OPTIONS] [MEMBER...]
39
40       tar --test-label [--file ARCHIVE] [OPTIONS] [LABEL...]
41
42       tar --update [--file ARCHIVE] [OPTIONS] [FILE...]
43
44       tar --update [-f ARCHIVE] [OPTIONS] [FILE...]
45
46       tar {--extract|--get} [-f ARCHIVE] [OPTIONS] [MEMBER...]
47

NOTE

49       This manpage is a short description of GNU tar.  For a detailed discus‐
50       sion, including examples and usage recommendations, refer  to  the  GNU
51       Tar Manual available in texinfo format.  If the info reader and the tar
52       documentation are properly installed on your system, the command
53
54           info tar
55
56       should give you access to the complete manual.
57
58       You can also view the manual using the info mode in emacs(1),  or  find
59       it in various formats online at
60
61           http://www.gnu.org/software/tar/manual
62
63       If any discrepancies occur between this manpage and the GNU Tar Manual,
64       the later shall be considered the authoritative source.
65

DESCRIPTION

67       GNU tar is an archiving program designed to store multiple files  in  a
68       single file (an archive), and to manipulate such archives.  The archive
69       can be either a regular file or a device (e.g. a tape drive, hence  the
70       name  of  the  program,  which  stands for tape archiver), which can be
71       located either on the local or on a remote machine.
72
73   Option styles
74       Options to GNU tar can be given in three different styles.   In  tradi‐
75       tional style, the first argument is a cluster of option letters and all
76       subsequent arguments supply arguments to  those  options  that  require
77       them.   The arguments are read in the same order as the option letters.
78       Any command line words that remain after all options has been processed
79       are treated as non-optional arguments: file or archive member names.
80
81       For  example,  the c option requires creating the archive, the v option
82       requests the verbose operation, and the f option takes an argument that
83       sets  the  name of the archive to operate upon.  The following command,
84       written in the traditional style, instructs tar to store all files from
85       the  directory /etc into the archive file etc.tar verbosely listing the
86       files being archived:
87
88       tar cfv a.tar /etc
89
90       In UNIX or short-option style, each option letter is  prefixed  with  a
91       single  dash,  as  in other command line utilities.  If an option takes
92       argument, the argument follows it, either as a  separate  command  line
93       word,  or  immediately  following  the  option.  However, if the option
94       takes an optional argument, the argument must follow the option  letter
95       without any intervening whitespace, as in -g/tmp/snar.db.
96
97       Any  number  of  options not taking arguments can be clustered together
98       after a single dash, e.g. -vkp.  Options that take  arguments  (whether
99       mandatory  or  optional), can appear at the end of such a cluster, e.g.
100       -vkpf a.tar.
101
102       The example command above written in the short-option style could  look
103       like:
104
105       tar -cvf a.tar /etc
106       or
107       tar -c -v -f a.tar /etc
108
109       In GNU or long-option style, each option begins with two dashes and has
110       a meaningful name, consisting of lower-case letters and  dashes.   When
111       used,  the  long option can be abbreviated to its initial letters, pro‐
112       vided that this does not create ambiguity.  Arguments to  long  options
113       are  supplied  either as a separate command line word, immediately fol‐
114       lowing the option, or separated from the option by an equals sign  with
115       no intervening whitespace.  Optional arguments must always use the lat‐
116       ter method.
117
118       Here are several ways of writing the example command in this style:
119
120       tar --create --file a.tar --verbose /etc
121       or (abbreviating some options):
122       tar --cre --file=a.tar --verb /etc
123
124       The options in all three styles can be intermixed,  although  doing  so
125       with old options is not encouraged.
126
127   Operation mode
128       The options listed in the table below tell GNU tar what operation it is
129       to perform.  Exactly one of  them  must  be  given.   Meaning  of  non-
130       optional arguments depends on the operation mode requested.
131
132       -A, --catenate, --concatenate
133              Append archive to the end of another archive.  The arguments are
134              treated as the names of archives to append.  All  archives  must
135              be  of the same format as the archive they are appended to, oth‐
136              erwise the resulting archive  might  be  unusable  with  non-GNU
137              implementations of tar.  Notice also that when more than one ar‐
138              chive is given, the members from archives other than  the  first
139              one  will  be  accessible in the resulting archive only if using
140              the -i (--ignore-zeros) option.
141
142              Compressed archives cannot be concatenated.
143
144       -c, --create
145              Create a new archive.  Arguments supply the names of  the  files
146              to  be  archived.   Directories are archived recursively, unless
147              the --no-recursion option is given.
148
149       -d, --diff, --compare
150              Find differences between archive and file system.  The arguments
151              are  optional  and  specify  archive members to compare.  If not
152              given, the current working directory is assumed.
153
154       --delete
155              Delete from the archive.  The arguments supply names of the  ar‐
156              chive  members  to  be  removed.   At least one argument must be
157              given.
158
159              This option does not operate on compressed archives.   There  is
160              no short option equivalent.
161
162       -r, --append
163              Append  files to the end of an archive.  Arguments have the same
164              meaning as for -c (--create).
165
166       -t, --list
167              List the contents of an archive.  Arguments are optional.   When
168              given, they specify the names of the members to list.
169
170       --test-label
171              Test the archive volume label and exit.  When used without argu‐
172              ments, it prints the volume label (if any) and exits with status
173              0.  When one or more command line arguments are given.  tar com‐
174              pares the volume label with each argument.  It exits with code 0
175              if  a  match  is found, and with code 1 otherwise.  No output is
176              displayed, unless used together with the -v (--verbose) option.
177
178              There is no short option equivalent for this option.
179
180       -u, --update
181              Append files which are newer than the corresponding copy in  the
182              archive.   Arguments  have  the  same  meaning as with -c and -r
183              options.  Notice, that newer files don't replace their  old  ar‐
184              chive  copies,  but  instead are appended to the end of archive.
185              The resulting archive can thus contain several  members  of  the
186              same name, corresponding to various versions of the same file.
187
188       -x, --extract, --get
189              Extract  files  from  an archive.  Arguments are optional.  When
190              given,  they  specify  names  of  the  archive  members  to   be
191              extracted.
192
193
194       --show-defaults
195              Show  built-in defaults for various tar options and exit.
196              No arguments are allowed.
197
198       -?, --help
199              Display a short option summary and  exit.   No  arguments
200              allowed.
201
202       --usage
203              Display  a  list of available options and exit.  No argu‐
204              ments allowed.
205
206       --version
207              Print program version and copyright information and exit.
208

OPTIONS

210   Operation modifiers
211       --check-device
212              Check device numbers when creating  incremental  archives
213              (default).
214
215       -g, --listed-incremental=FILE
216              Handle  new  GNU-format incremental backups.  FILE is the
217              name of a snapshot  file,  where  tar  stores  additional
218              information  which  is used to decide which files changed
219              since the previous incremental  dump  and,  consequently,
220              must be dumped again.  If FILE does not exist when creat‐
221              ing an archive, it will be created and all files will  be
222              added  to  the  resulting archive (the level 0 dump).  To
223              create incremental archives of non-zero level N, create a
224              copy  of  the snapshot file created during the level N-1,
225              and use it as FILE.
226
227              When listing or extracting, the actual contents  of  FILE
228              is  not  inspected,  it is needed only due to syntactical
229              requirements.  It is therefore  common  practice  to  use
230              /dev/null in its place.
231
232       --hole-detection=METHOD
233              Use  METHOD to detect holes in sparse files.  This option
234              implies --sparse.  Valid values for METHOD are  seek  and
235              raw.   Default  is  seek  with  fallback  to raw when not
236              applicable.
237
238       -G, --incremental
239              Handle old GNU-format incremental backups.
240
241       --ignore-failed-read
242              Do not exit with nonzero on unreadable files.
243
244       --level=NUMBER
245              Set dump level for  created  listed-incremental  archive.
246              Currently  only --level=0 is meaningful: it instructs tar
247              to truncate the snapshot  file  before  dumping,  thereby
248              forcing a level 0 dump.
249
250       -n, --seek
251              Assume  the archive is seekable.  Normally tar determines
252              automatically whether the archive can be seeked  or  not.
253              This option is intended for use in cases when such recog‐
254              nition fails.  It takes effect only  if  the  archive  is
255              open   for   reading   (e.g.  with  --list  or  --extract
256              options).
257
258       --no-check-device
259              Do not check device numbers when creating incremental ar‐
260              chives.
261
262       --no-seek
263              Assume the archive is not seekable.
264
265       --occurrence[=N]
266              Process  only  the Nth occurrence of each file in the ar‐
267              chive.  This option is valid only when used with  one  of
268              the following subcommands: --delete, --diff, --extract or
269              --list and when a list of files is given  either  on  the
270              command line or via the -T option.  The default N is 1.
271
272       --restrict
273              Disable the use of some potentially harmful options.
274
275       --sparse-version=MAJOR[.MINOR]
276              Set   version  of  the  sparse  format  to  use  (implies
277              --sparse).  This option implies --sparse.  Valid argument
278              values  are 0.0, 0.1, and 1.0.  For a detailed discussion
279              of sparse formats, refer to the GNU Tar Manual,  appendix
280              D,  "Sparse  Formats".   Using  info  reader,  it  can be
281              accessed running the following command: info tar  'Sparse
282              Formats'.
283
284       -S, --sparse
285              Handle  sparse files efficiently.  Some files in the file
286              system may have segments which were actually never  writ‐
287              ten (quite often these are database files created by such
288              systems as DBM).  When given this option, tar attempts to
289              determine  if  the  file is sparse prior to archiving it,
290              and if so, to reduce the resulting archive  size  by  not
291              dumping empty parts of the file.
292
293   Overwrite control
294       These options control tar actions when extracting a file over an
295       existing copy on disk.
296
297       -k, --keep-old-files
298              Don't replace existing files when extracting.
299
300       --keep-newer-files
301              Don't replace existing files that are  newer  than  their
302              archive copies.
303
304       --keep-directory-symlink
305              Don't  replace  existing  symlinks  to  directories  when
306              extracting.
307
308       --no-overwrite-dir
309              Preserve metadata of existing directories.
310
311       --one-top-level[=DIR]
312              Extract all files into DIR, or, if used without argument,
313              into a subdirectory named by the base name of the archive
314              (minus  standard  compression  suffixes  recognizable  by
315              --auto-compress).
316
317       --overwrite
318              Overwrite existing files when extracting.
319
320       --overwrite-dir
321              Overwrite  metadata of existing directories when extract‐
322              ing (default).
323
324       --recursive-unlink
325              Recursively remove all files in the  directory  prior  to
326              extracting it.
327
328       --remove-files
329              Remove files from disk after adding them to the archive.
330
331       --skip-old-files
332              Don't  replace  existing  files when extracting, silently
333              skip over them.
334
335       -U, --unlink-first
336              Remove each file prior to extracting over it.
337
338       -W, --verify
339              Verify the archive after writing it.
340
341   Output stream selection
342       --ignore-command-error
343
344       Ignore subprocess exit codes.
345
346       --no-ignore-command-error
347              Treat non-zero exit codes of children as error (default).
348
349       -O, --to-stdout
350              Extract files to standard output.
351
352       --to-command=COMMAND
353              Pipe extracted files to COMMAND.   The  argument  is  the
354              pathname  of an external program, optionally with command
355              line arguments.  The program will be invoked and the con‐
356              tents  of  the file being extracted supplied to it on its
357              standard output.  Additional data will  be  supplied  via
358              the following environment variables:
359
360              TAR_FILETYPE
361                     Type  of  the file. It is a single letter with the
362                     following meaning:
363
364                             f           Regular file
365                             d           Directory
366                             l           Symbolic link
367                             h           Hard link
368                             b           Block device
369                             c           Character device
370
371                     Currently only regular files are supported.
372
373              TAR_MODE
374                     File mode, an octal number.
375
376              TAR_FILENAME
377                     The name of the file.
378
379              TAR_REALNAME
380                     Name of the file as stored in the archive.
381
382              TAR_UNAME
383                     Name of the file owner.
384
385              TAR_GNAME
386                     Name of the file owner group.
387
388              TAR_ATIME
389                     Time of last access. It is a decimal number,  rep‐
390                     resenting seconds since the Epoch.  If the archive
391                     provides  times  with  nanosecond  precision,  the
392                     nanoseconds  are appended to the timestamp after a
393                     decimal point.
394
395              TAR_MTIME
396                     Time of last modification.
397
398              TAR_CTIME
399                     Time of last status change.
400
401              TAR_SIZE
402                     Size of the file.
403
404              TAR_UID
405                     UID of the file owner.
406
407              TAR_GID
408                     GID of the file owner.
409
410              Additionally, the following variables contain information
411              about tar operation mode and the archive being processed:
412
413              TAR_VERSION
414                     GNU tar version number.
415
416              TAR_ARCHIVE
417                     The name of the archive tar is processing.
418
419              TAR_BLOCKING_FACTOR
420                     Current  blocking  factor, i.e. number of 512-byte
421                     blocks in a record.
422
423              TAR_VOLUME
424                     Ordinal number of the  volume  tar  is  processing
425                     (set if reading a multi-volume archive).
426
427              TAR_FORMAT
428                     Format  of  the  archive being processed.  One of:
429                     gnu, oldgnu, posix, ustar, v7.   TAR_SUBCOMMAND  A
430                     short  option (with a leading dash) describing the
431                     operation tar is executing.
432
433   Handling of file attributes
434       --atime-preserve[=METHOD]
435              Preserve access times on dumped files, either by  restor‐
436              ing  the times after reading (METHOD=replace, this is the
437              default) or by not setting the times in the  first  place
438              (METHOD=system)
439
440       --delay-directory-restore
441              Delay  setting  modification  times  and  permissions  of
442              extracted directories until the end of  extraction.   Use
443              this  option  when  extracting  from an archive which has
444              unusual member ordering.
445
446       --group=NAME[:GID]
447              Force NAME as group for added files.  If GID is not  sup‐
448              plied, NAME can be either a user name or numeric GID.  In
449              this case the missing part (GID or name) will be inferred
450              from the current host's group database.
451
452              When used with --group-map=FILE, affects only those files
453              whose owner group is not listed in FILE.
454
455       --group-map=FILE
456              Read group translation map from FILE.   Empty  lines  are
457              ignored.   Comments are introduced with # sign and extend
458              to the end of line.  Each non-empty line in FILE  defines
459              translation  for  a single group.  It must consist of two
460              fields, delimited by any amount of whitespace:
461
462              OLDGRP NEWGRP[:NEWGID]
463
464              OLDGRP is either a valid group name  or  a  GID  prefixed
465              with  +.   Unless NEWGID is supplied, NEWGRP must also be
466              either a valid group name or  a  +GID.   Otherwise,  both
467              NEWGRP  and NEWGID need not be listed in the system group
468              database.
469
470              As a result, each input file with owner group OLDGRP will
471              be  stored  in  archive  with  owner group NEWGRP and GID
472              NEWGID.
473
474       --mode=CHANGES
475              Force symbolic mode CHANGES for added files.
476
477       --mtime=DATE-OR-FILE
478              Set mtime for added  files.   DATE-OR-FILE  is  either  a
479              date/time  in  almost arbitrary format, or the name of an
480              existing file.  In the latter case the mtime of that file
481              will be used.
482
483       -m, --touch
484              Don't extract file modified time.
485
486       --no-delay-directory-restore
487              Cancel  the effect of the prior --delay-directory-restore
488              option.
489
490       --no-same-owner
491              Extract files as yourself (default for ordinary users).
492
493       --no-same-permissions
494              Apply the user's umask when extracting  permissions  from
495              the archive (default for ordinary users).
496
497       --numeric-owner
498              Always use numbers for user/group names.
499
500       --owner=NAME[:UID]
501              Force  NAME as owner for added files.  If UID is not sup‐
502              plied, NAME can be either a user name or numeric UID.  In
503              this case the missing part (UID or name) will be inferred
504              from the current host's user database.
505
506              When used with --owner-map=FILE, affects only those files
507              whose owner is not listed in FILE.
508
509       --owner-map=FILE
510              Read  owner  translation  map from FILE.  Empty lines are
511              ignored.  Comments are introduced with # sign and  extend
512              to  the end of line.  Each non-empty line in FILE defines
513              translation for a single UID.  It  must  consist  of  two
514              fields, delimited by any amount of whitespace:
515
516              OLDUSR NEWUSR[:NEWUID]
517
518              OLDUSR is either a valid user name or a UID prefixed with
519              +.  Unless NEWUID is supplied, NEWUSR must also be either
520              a  valid user name or a +UID.  Otherwise, both NEWUSR and
521              NEWUID need not be listed in the system user database.
522
523              As a result, each input file  owned  by  OLDUSR  will  be
524              stored in archive with owner name NEWUSR and UID NEWUID.
525
526       -p, --preserve-permissions, --same-permissions
527              extract  information  about file permissions (default for
528              superuser)
529
530       --preserve
531              Same as both -p and -s.
532
533       --same-owner
534              Try extracting files with the same ownership as exists in
535              the archive (default for superuser).
536
537       -s, --preserve-order, --same-order
538              Sort names to extract to match archive
539
540       --sort=ORDER
541              When  creating an archive, sort directory entries accord‐
542              ing to ORDER, which is one of none, name, or inode.
543
544              The default is --sort=none, which stores archive  members
545              in the same order as returned by the operating system.
546
547              Using --sort=name ensures the member ordering in the cre‐
548              ated archive is uniform and reproducible.
549
550              Using --sort=inode reduces the number of disk seeks  made
551              when creating the archive and thus can considerably speed
552              up archivation.  This sorting order is supported only  if
553              the underlying system provides the necessary information.
554
555   Extended file attributes
556       --acls Enable POSIX ACLs support.
557
558       --no-acls
559              Disable POSIX ACLs support.
560
561       --selinux
562              Enable SELinux context support.
563
564       --no-selinux
565              Disable SELinux context support.
566
567       --xattrs
568              Enable extended attributes support.
569
570       --no-xattrs
571              Disable extended attributes support.
572
573       --xattrs-exclude=PATTERN
574              Specify the exclude pattern for xattr keys.  PATTERN is a
575              POSIX regular expression, e.g. --xattrs-exclude='^user.',
576              to exclude attributes from the user namespace.
577
578       --xattrs-include=PATTERN
579              Specify the include pattern for xattr keys.  PATTERN is a
580              POSIX regular expression.
581
582   Device selection and switching
583       -f, --file=ARCHIVE
584              Use archive file or device ARCHIVE.  If  this  option  is
585              not  given,  tar will first examine the environment vari‐
586              able `TAPE'.  If it is set, its value will be used as the
587              archive name.  Otherwise, tar will assume the compiled-in
588              default.  The default value can be inspected either using
589              the  --show-defaults  option,  or  at  the end of the tar
590              --help output.
591
592              An archive name that has a colon in it specifies  a  file
593              or device on a remote machine.  The part before the colon
594              is taken as the machine name or IP address, and the  part
595              after it as the file or device pathname, e.g.:
596
597              --file=remotehost:/dev/sr0
598
599              An  optional  username  can  be prefixed to the hostname,
600              placing a @ sign between them.
601
602              By default, the remote host is accessed  via  the  rsh(1)
603              command.   Nowadays  it  is common to use ssh(1) instead.
604              You can do  so  by  giving  the  following  command  line
605              option:
606
607              --rsh-command=/usr/bin/ssh
608
609              The   remote  machine  should  have  the  rmt(8)  command
610              installed.  If its pathname does not match tar's default,
611              you  can  inform tar about the correct pathname using the
612              --rmt-command option.
613
614       --force-local
615              Archive file is local even if it has a colon.
616
617       -F, --info-script=COMMAND, --new-volume-script=COMMAND
618              Run COMMAND at the end of each tape  (implies  -M).   The
619              command  can  include  arguments.   When started, it will
620              inherit tar's environment plus the following variables:
621
622              TAR_VERSION
623                     GNU tar version number.
624
625              TAR_ARCHIVE
626                     The name of the archive tar is processing.
627
628              TAR_BLOCKING_FACTOR
629                     Current blocking factor, i.e. number  of  512-byte
630                     blocks in a record.
631
632              TAR_VOLUME
633                     Ordinal  number  of  the  volume tar is processing
634                     (set if reading a multi-volume archive).
635
636              TAR_FORMAT
637                     Format of the archive being  processed.   One  of:
638                     gnu, oldgnu, posix, ustar, v7.
639
640              TAR_SUBCOMMAND
641                     A  short  option  (with a leading dash) describing
642                     the operation tar is executing.
643
644              TAR_FD File descriptor which can be used  to  communicate
645                     the new volume name to tar.
646
647              If the info script fails, tar exits; otherwise, it begins
648              writing the next volume.
649
650       -L, --tape-length=N
651              Change tape after writing Nx1024 bytes.  If N is followed
652              by  a  size  suffix  (see  the  subsection  Size suffixes
653              below), the suffix specifies the multiplicative factor to
654              be used instead of 1024.
655
656              This option implies -M.
657
658       -M, --multi-volume
659              Create/list/extract multi-volume archive.
660
661       --rmt-command=COMMAND
662              Use  COMMAND  instead  of  rmt  when accessing remote ar‐
663              chives.  See the description of the -f option, above.
664
665       --rsh-command=COMMAND
666              Use COMMAND instead of  rsh  when  accessing  remote  ar‐
667              chives.  See the description of the -f option, above.
668
669       --volno-file=FILE
670              When this option is used in conjunction with --multi-vol‐
671              ume, tar will keep track of which volume of a  multi-vol‐
672              ume archive it is working in FILE.
673
674   Device blocking
675       -b, --blocking-factor=BLOCKS
676              Set record size to BLOCKSx512 bytes.
677
678       -B, --read-full-records
679              When  listing  or  extracting,  accept  incomplete  input
680              records after end-of-file marker.
681
682       -i, --ignore-zeros
683              Ignore zeroed blocks in archive.  Normally  two  consecu‐
684              tive 512-blocks filled with zeroes mean EOF and tar stops
685              reading after encountering them.  This  option  instructs
686              it  to  read  further and is useful when reading archives
687              created with the -A option.
688
689       --record-size=NUMBER
690              Set record size.  NUMBER  is  the  number  of  bytes  per
691              record.   It must be multiple of 512.  It can can be suf‐
692              fixed with a size suffix, e.g. --record-size=10K, for  10
693              Kilobytes.   See the subsection Size suffixes, for a list
694              of valid suffixes.
695
696   Archive format selection
697       -H, --format=FORMAT
698              Create archive of the given format.  Valid formats are:
699
700              gnu    GNU tar 1.13.x format
701
702              oldgnu GNU format as per tar <= 1.12.
703
704              pax, posix
705                     POSIX 1003.1-2001 (pax) format.
706
707              ustar  POSIX 1003.1-1988 (ustar) format.
708
709              v7     Old V7 tar format.
710
711       --old-archive, --portability
712              Same as --format=v7.
713
714       --pax-option=keyword[[:]=value][,keyword[[:]=value]]...
715              Control pax keywords when creating PAX archives (-H pax).
716              This  option  is  equivalent  to  the  -o  option  of the
717              pax(1)utility.
718
719       --posix
720              Same as --format=posix.
721
722       -V, --label=TEXT
723              Create archive with volume  name  TEXT.   If  listing  or
724              extracting,  use  TEXT  as  a globbing pattern for volume
725              name.
726
727   Compression options
728       -a, --auto-compress
729              Use archive suffix to determine the compression program.
730
731       -I, --use-compress-program=COMMAND
732              Filter data through  COMMAND.   It  must  accept  the  -d
733              option, for decompression.  The argument can contain com‐
734              mand line options.
735
736       -j, --bzip2
737              Filter the archive through bzip2(1).
738
739       -J, --xz
740              Filter the archive through xz(1).
741
742       --lzip Filter the archive through lzip(1).
743
744       --lzma Filter the archive through lzma(1).
745
746       --lzop Filter the archive through lzop(1).
747
748       --no-auto-compress
749              Do not use archive suffix to  determine  the  compression
750              program.
751
752       -z, --gzip, --gunzip, --ungzip
753              Filter the archive through gzip(1).
754
755       -Z, --compress, --uncompress
756              Filter the archive through compress(1).
757
758   Local file selection
759       --add-file=FILE
760              Add FILE to the archive (useful if its name starts with a
761              dash).
762
763       --backup[=CONTROL]
764              Backup before removal.  The  CONTROL  argument,  if  sup‐
765              plied, controls the backup policy.  Its valid values are:
766
767              none, off
768                     Never make backups.
769
770              t, numbered
771                     Make numbered backups.
772
773              nil, existing
774                     Make  numbered  backups if numbered backups exist,
775                     simple backups otherwise.
776
777              never, simple
778                     Always make simple backups
779
780              If CONTROL is not given, the value is taken from the VER‐
781              SION_CONTROL  environment  variable.   If  it is not set,
782              existing is assumed.
783
784       -C, --directory=DIR
785              Change to DIR before  performing  any  operations.   This
786              option  is  order-sensitive,  i.e. it affects all options
787              that follow.
788
789       --exclude=PATTERN
790              Exclude files matching PATTERN, a glob(3)-style  wildcard
791              pattern.
792
793       --exclude-backups
794              Exclude backup and lock files.
795
796       --exclude-caches
797              Exclude   contents   of   directories   containing   file
798              CACHEDIR.TAG, except for the tag file itself.
799
800       --exclude-caches-all
801              Exclude directories containing file CACHEDIR.TAG and  the
802              file itself.
803
804       --exclude-caches-under
805              Exclude    everything    under   directories   containing
806              CACHEDIR.TAG
807
808       --exclude-ignore=FILE
809              Before dumping a directory, see if it contains FILE.   If
810              so, read exclusion patterns from this file.  The patterns
811              affect only the directory itself.
812
813       --exclude-ignore-recursive=FILE
814              Same as --exclude-ignore, except that patterns from  FILE
815              affect both the directory and all its subdirectories.
816
817       --exclude-tag=FILE
818              Exclude  contents  of directories containing FILE, except
819              for FILE itself.
820
821       --exclude-tag-all=FILE
822              Exclude directories containing FILE.
823
824       --exclude-tag-under=FILE
825              Exclude everything under directories containing FILE.
826
827       --exclude-vcs
828              Exclude version control system directories.
829
830       --exclude-vcs-ignores
831              Exclude files that match patterns read from  VCS-specific
832              ignore  files.   Supported files are: .cvsignore, .gitig‐
833              nore, .bzrignore, and .hgignore.
834
835       -h, --dereference
836              Follow symlinks; archive and dump the  files  they  point
837              to.
838
839       --hard-dereference
840              Follow  hard links; archive and dump the files they refer
841              to.
842
843       -K, --starting-file=MEMBER
844              Begin at the given member in the archive.
845
846       --newer-mtime=DATE
847              Work on files whose data changed after the DATE.  If DATE
848              starts  with  /  or  . it is taken to be a file name; the
849              mtime of that file is used as the date.
850
851       --no-null
852              Disable the effect of the previous --null option.
853
854       --no-recursion
855              Avoid descending automatically in directories.
856
857       --no-unquote
858              Do not unquote input file or member names.
859
860       --no-verbatim-files-from
861              Treat each line read from a file list as if it were  sup‐
862              plied  in  the  command line.  I.e., leading and trailing
863              whitespace is removed and, if the resulting string begins
864              with a dash, it is treated as tar command line option.
865
866              This   is   the   default   behavior.    The  --no-verba‐
867              tim-files-from option is provided as a way to restore  it
868              after --verbatim-files-from option.
869
870              This  option  is  positional: it affects all --files-from
871              options  that  occur  after   it   in,   until   --verba‐
872              tim-files-from  option  or  end of line, whichever occurs
873              first.
874
875              It is implied by the --no-null option.
876
877       --null Instruct subsequent -T options  to  read  null-terminated
878              names  verbatim  (disables special handling of names that
879              start with a dash).
880
881              See also --verbatim-files-from.
882
883       -N, --newer=DATE, --after-date=DATE
884              Only store files newer than DATE.  If DATE starts with  /
885              or  .  it  is  taken to be a file name; the ctime of that
886              file is used as the date.
887
888       --one-file-system
889              Stay in local file system when creating archive.
890
891       -P, --absolute-names
892              Don't strip leading slashes from file names when creating
893              archives.
894
895       --recursion
896              Recurse into directories (default).
897
898       --suffix=STRING
899              Backup  before  removal,  override usual suffix.  Default
900              suffix is ~, unless overridden  by  environment  variable
901              SIMPLE_BACKUP_SUFFIX.
902
903       -T, --files-from=FILE
904              Get names to extract or create from FILE.
905
906              Unless  specified otherwise, the FILE must contain a list
907              of names separated by ASCII LF (i.e. one name per  line).
908              The  names  read are handled the same way as command line
909              arguments.  They undergo quote removal  and  word  split‐
910              ting,  and  any string that starts with a - is handled as
911              tar command line option.
912
913              If this behavior is undesirable, it  can  be  turned  off
914              using the --verbatim-files-from option.
915
916              The  --null  option  instructs tar that the names in FILE
917              are separated by ASCII NUL character, instead of LF.   It
918              is  useful  if  the  list is generated by find(1) -print0
919              predicate.
920
921       --unquote
922              Unquote file or member names (default).
923
924       --verbatim-files-from
925              Treat each line obtained from a file list as a file name,
926              even  if  it starts with a dash.  File lists are supplied
927              with the --files-from (-T) option.  The default  behavior
928              is to handle names supplied in file lists as if they were
929              typed in the command line, i.e. any names starting with a
930              dash   are   treated   as   tar  options.   The  --verba‐
931              tim-files-from option disables this behavior.
932
933              This option affects all --files-from options  that  occur
934              after  it in the command line.  Its effect is reverted by
935              the --no-verbatim-files-from} option.
936
937              This option is implied by the --null option.
938
939              See also --add-file.
940
941       -X, --exclude-from=FILE
942              Exclude files matching patterns listed in FILE.
943
944   File name transformations
945       --strip-components=NUMBER
946              Strip  NUMBER  leading  components  from  file  names  on
947              extraction.
948
949       --transform=EXPRESSION, --xform=EXPRESSION
950              Use sed replace EXPRESSION to transform file names.
951
952   File name matching options
953       These options affect both exclude and include patterns.
954
955       --anchored
956              Patterns match file name start.
957
958       --ignore-case
959              Ignore case.
960
961       --no-anchored
962              Patterns match after any / (default for exclusion).
963
964       --no-ignore-case
965              Case sensitive matching (default).
966
967       --no-wildcards
968              Verbatim string matching.
969
970       --no-wildcards-match-slash
971              Wildcards do not match /.
972
973       --wildcards
974              Use wildcards (default for exclusion).
975
976       --wildcards-match-slash
977              Wildcards match / (default for exclusion).
978
979   Informative output
980       --checkpoint[=N]
981              Display progress messages every Nth record (default 10).
982
983       --checkpoint-action=ACTION
984              Run ACTION on each checkpoint.
985
986       --clamp-mtime
987              Only  set time when the file is more recent than what was
988              given with --mtime.
989
990       --full-time
991              Print file time to its full resolution.
992
993       --index-file=FILE
994              Send verbose output to FILE.
995
996       -l, --check-links
997              Print a message if not all links are dumped.
998
999       --no-quote-chars=STRING
1000              Disable quoting for characters from STRING.
1001
1002       --quote-chars=STRING
1003              Additionally quote characters from STRING.
1004
1005       --quoting-style=STYLE
1006              Set quoting style for file and member names.  Valid  val‐
1007              ues  for  STYLE  are  literal, shell, shell-always, c, c-
1008              maybe, escape, locale, clocale.
1009
1010       -R, --block-number
1011              Show block number within archive with each message.
1012
1013       --show-omitted-dirs
1014              When listing or extracting, list each directory that does
1015              not match search criteria.
1016
1017       --show-transformed-names, --show-stored-names
1018              Show  file  or  archive  names  after  transformation  by
1019              --strip and --transform options.
1020
1021       --totals[=SIGNAL]
1022              Print total bytes after processing the archive.  If  SIG‐
1023              NAL  is  given,  print  total  bytes  when this signal is
1024              delivered.  Allowed signals are: SIGHUP, SIGQUIT, SIGINT,
1025              SIGUSR1, and SIGUSR2.  The SIG prefix can be omitted.
1026
1027       --utc  Print file modification times in UTC.
1028
1029       -v, --verbose
1030              Verbosely list files processed.
1031
1032       --warning=KEYWORD
1033              Enable or disable warning messages identified by KEYWORD.
1034              The messages are suppressed if KEYWORD is  prefixed  with
1035              no- and enabled otherwise.
1036
1037              Multiple --warning messages accumulate.
1038
1039              Keywords controlling general tar operation:
1040
1041              all    Enable all warning messages.  This is the default.
1042
1043              none   Disable all warning messages.
1044
1045              filename-with-nuls
1046                     "%s: file name read contains nul character"
1047
1048              alone-zero-block
1049                     "A lone zero block at %s"
1050
1051              Keywords applicable for tar --create:
1052
1053              cachedir
1054                     "%s: contains a cache directory tag %s; %s"
1055
1056              file-shrank
1057                     "%s: File shrank by %s bytes; padding with zeros"
1058
1059              xdev   "%s:  file  is  on  a  different  filesystem;  not
1060                     dumped"
1061
1062              file-ignored
1063                     "%s: Unknown file type; file ignored"
1064                     "%s: socket ignored"
1065                     "%s: door ignored"
1066
1067              file-unchanged
1068                     "%s: file is unchanged; not dumped"
1069
1070              ignore-archive
1071                     "%s: file is the archive; not dumped"
1072
1073              file-removed
1074                     "%s: File removed before we read it"
1075
1076              file-changed
1077                     "%s: file changed as we read it"
1078
1079              failed-read
1080                     Suppresses  warnings  about  unreadable  files  or
1081                     directories.  This  keyword  applies  only if used
1082                     together with the --ignore-failed-read option.
1083
1084              Keywords applicable for tar --extract:
1085
1086              existing-file
1087                     "%s: skipping existing file"
1088
1089              timestamp
1090                     "%s: implausibly old time stamp %s"
1091                     "%s: time stamp %s is %s s in the future"
1092
1093              contiguous-cast
1094                     "Extracting contiguous files as regular files"
1095
1096              symlink-cast
1097                     "Attempting extraction of symbolic links  as  hard
1098                     links"
1099
1100              unknown-cast
1101                     "%s:  Unknown  file type '%c', extracted as normal
1102                     file"
1103
1104              ignore-newer
1105                     "Current %s is newer or same age"
1106
1107              unknown-keyword
1108                     "Ignoring unknown extended header keyword '%s'"
1109
1110              decompress-program
1111                     Controls verbose description of failures occurring
1112                     when  trying  to run alternative decompressor pro‐
1113                     grams.   This  warning  is  disabled  by   default
1114                     (unless  --verbose  is used).  A common example of
1115                     what you can get when using this warning is:
1116
1117                     $ tar --warning=decompress-program -x -f archive.Z
1118                     tar (child): cannot run compress: No such file or directory
1119                     tar (child): trying gzip
1120
1121                     This means that tar first tried to decompress  ar‐
1122                     chive.Z  using  compress,  and,  when that failed,
1123                     switched to gzip.
1124
1125              record-size
1126                     "Record size = %lu blocks"
1127
1128              Keywords controlling incremental extraction:
1129
1130              rename-directory
1131                     "%s: Directory has been renamed from %s"
1132                     "%s: Directory has been renamed"
1133
1134              new-directory
1135                     "%s: Directory is new"
1136
1137              xdev   "%s: directory is on a different device: not purg‐
1138                     ing"
1139
1140              bad-dumpdir
1141                     "Malformed dumpdir: 'X' never used"
1142
1143       -w, --interactive, --confirmation
1144              Ask for confirmation for every action.
1145
1146   Compatibility options
1147       -o     When  creating,  same as --old-archive.  When extracting,
1148              same as --no-same-owner.
1149
1150   Size suffixes
1151               Suffix    Units                   Byte Equivalent
1152               b         Blocks                  SIZE x 512
1153               B         Kilobytes               SIZE x 1024
1154               c         Bytes                   SIZE
1155               G         Gigabytes               SIZE x 1024^3
1156               K         Kilobytes               SIZE x 1024
1157               k         Kilobytes               SIZE x 1024
1158               M         Megabytes               SIZE x 1024^2
1159               P         Petabytes               SIZE x 1024^5
1160               T         Terabytes               SIZE x 1024^4
1161               w         Words                   SIZE x 2
1162

RETURN VALUE

1164       Tar exit code indicates whether it was able to successfully per‐
1165       form  the  requested  operation,  and if not, what kind of error
1166       occurred.
1167
1168       0      Successful termination.
1169
1170       1      Some files differ.  If tar was invoked with the --compare
1171              (--diff,  -d)  command  line option, this means that some
1172              files in the archive differ from their disk counterparts.
1173              If  tar  was  given  one  of  the  --create,  --append or
1174              --update options, this exit code means  that  some  files
1175              were  changed  while  being archived and so the resulting
1176              archive does not contain the exact copy of the file set.
1177
1178       2      Fatal error.  This means that some  fatal,  unrecoverable
1179              error occurred.
1180
1181       If  a  subprocess  that  had  been  invoked by tar exited with a
1182       nonzero exit code, tar itself exits  with  that  code  as  well.
1183       This  can happen, for example, if a compression option (e.g. -z)
1184       was used and the external compressor  program  failed.   Another
1185       example is rmt failure during backup to a remote device.
1186

SEE ALSO

1188       bzip2(1),  compress(1),  gzip(1), lzma(1), lzop(1), rmt(8), sym‐
1189       link(7), tar(5), xz(1).
1190
1191       Complete tar manual: run info tar or use emacs(1) info  mode  to
1192       read it.
1193
1194       Online copies of GNU tar documentation in various formats can be
1195       found at:
1196
1197           http://www.gnu.org/software/tar/manual
1198

BUG REPORTS

1200       Report bugs to <bug-tar@gnu.org>.
1201
1203       Copyright © 2013 Free Software Foundation, Inc.
1204       License GPLv3+: GNU GPL version 3 or later
1205       <http://gnu.org/licenses/gpl.html>
1206       This  is  free software: you are free to change and redistribute
1207       it.  There is NO WARRANTY, to the extent permitted by law.
1208
1209
1210
1211
1212TAR                            November 16, 2017                        TAR(1)
Impressum