/ src / tools / corpus-gnu / tar-help.txt
tar-help.txt
  1  Usage: tar [OPTION...] [FILE]...
  2  GNU 'tar' saves many files together into a single tape or disk archive, and can
  3  restore individual files from the archive.
  4  
  5  Examples:
  6    tar -cf archive.tar foo bar  # Create archive.tar from files foo and bar.
  7    tar -tvf archive.tar         # List all files in archive.tar verbosely.
  8    tar -xf archive.tar          # Extract all files from archive.tar.
  9  
 10   Main operation mode:
 11    -A, --catenate, --concatenate   append tar files to an archive
 12    -c, --create               create a new archive
 13        --delete               delete from the archive (not on mag tapes!)
 14    -d, --diff, --compare      find differences between archive and file system
 15    -r, --append               append files to the end of an archive
 16        --test-label           test the archive volume label and exit
 17    -t, --list                 list the contents of an archive
 18    -u, --update               only append files newer than copy in archive
 19    -x, --extract, --get       extract files from an archive
 20  
 21   Operation modifiers:
 22  
 23        --check-device         check device numbers when creating incremental
 24                               archives (default)
 25    -g, --listed-incremental=FILE   handle new GNU-format incremental backup
 26    -G, --incremental          handle old GNU-format incremental backup
 27        --hole-detection=TYPE  technique to detect holes
 28        --ignore-failed-read   do not exit with nonzero on unreadable files
 29        --level=NUMBER         dump level for created listed-incremental archive
 30        --no-check-device      do not check device numbers when creating
 31                               incremental archives
 32        --no-seek              archive is not seekable
 33    -n, --seek                 archive is seekable
 34        --occurrence[=NUMBER]  process only the NUMBERth occurrence of each file
 35                               in the archive; this option is valid only in
 36                               conjunction with one of the subcommands --delete,
 37                               --diff, --extract or --list and when a list of
 38                               files is given either on the command line or via
 39                               the -T option; NUMBER defaults to 1
 40        --sparse-version=MAJOR[.MINOR]
 41                               set version of the sparse format to use (implies
 42                               --sparse)
 43    -S, --sparse               handle sparse files efficiently
 44  
 45   Local file name selection:
 46        --add-file=FILE        add given FILE to the archive (useful if its name
 47                               starts with a dash)
 48    -C, --directory=DIR        change to directory DIR
 49        --exclude=PATTERN      exclude files, given as a PATTERN
 50        --exclude-backups      exclude backup and lock files
 51        --exclude-caches       exclude contents of directories containing
 52                               CACHEDIR.TAG, except for the tag file itself
 53        --exclude-caches-all   exclude directories containing CACHEDIR.TAG
 54        --exclude-caches-under exclude everything under directories containing
 55                               CACHEDIR.TAG
 56        --exclude-ignore=FILE  read exclude patterns for each directory from
 57                               FILE, if it exists
 58        --exclude-ignore-recursive=FILE
 59                               read exclude patterns for each directory and its
 60                               subdirectories from FILE, if it exists
 61        --exclude-tag=FILE     exclude contents of directories containing FILE,
 62                               except for FILE itself
 63        --exclude-tag-all=FILE exclude directories containing FILE
 64        --exclude-tag-under=FILE   exclude everything under directories
 65                               containing FILE
 66        --exclude-vcs          exclude version control system directories
 67        --exclude-vcs-ignores  read exclude patterns from the VCS ignore files
 68        --no-null              disable the effect of the previous --null option
 69        --no-recursion         avoid descending automatically in directories
 70        --no-unquote           do not unquote input file or member names
 71        --no-verbatim-files-from   -T treats file names starting with dash as
 72                               options (default)
 73        --null                 -T reads null-terminated names; implies
 74                               --verbatim-files-from
 75        --recursion            recurse into directories (default)
 76    -T, --files-from=FILE      get names to extract or create from FILE
 77        --unquote              unquote input file or member names (default)
 78        --verbatim-files-from  -T reads file names verbatim (no escape or option
 79                               handling)
 80    -X, --exclude-from=FILE    exclude patterns listed in FILE
 81  
 82   File name matching options (affect both exclude and include patterns):
 83  
 84        --anchored             patterns match file name start
 85        --ignore-case          ignore case
 86        --no-anchored          patterns match after any '/' (default for
 87                               exclusion)
 88        --no-ignore-case       case sensitive matching (default)
 89        --no-wildcards         verbatim string matching
 90        --no-wildcards-match-slash   wildcards do not match '/'
 91        --wildcards            use wildcards (default for exclusion)
 92        --wildcards-match-slash   wildcards match '/' (default for exclusion)
 93  
 94   Overwrite control:
 95  
 96        --keep-directory-symlink   preserve existing symlinks to directories when
 97                               extracting
 98        --keep-newer-files     don't replace existing files that are newer than
 99                               their archive copies
100    -k, --keep-old-files       don't replace existing files when extracting,
101                               treat them as errors
102        --no-overwrite-dir     preserve metadata of existing directories
103        --one-top-level[=DIR]  create a subdirectory to avoid having loose files
104                               extracted
105        --overwrite            overwrite existing files when extracting
106        --overwrite-dir        overwrite metadata of existing directories when
107                               extracting (default)
108        --recursive-unlink     empty hierarchies prior to extracting directory
109        --remove-files         remove files after adding them to the archive
110        --skip-old-files       don't replace existing files when extracting,
111                               silently skip over them
112    -U, --unlink-first         remove each file prior to extracting over it
113    -W, --verify               attempt to verify the archive after writing it
114  
115   Select output stream:
116  
117        --ignore-command-error ignore exit codes of children
118        --no-ignore-command-error   treat non-zero exit codes of children as
119                               error
120    -O, --to-stdout            extract files to standard output
121        --to-command=COMMAND   pipe extracted files to another program
122  
123   Handling of file attributes:
124  
125        --atime-preserve[=METHOD]   preserve access times on dumped files, either
126                               by restoring the times after reading
127                               (METHOD='replace'; default) or by not setting the
128                               times in the first place (METHOD='system')
129        --clamp-mtime          only set time when the file is more recent than
130                               what was given with --mtime
131        --delay-directory-restore   delay setting modification times and
132                               permissions of extracted directories until the end
133                               of extraction
134        --group=NAME           force NAME as group for added files
135        --group-map=FILE       use FILE to map file owner GIDs and names
136        --mode=CHANGES         force (symbolic) mode CHANGES for added files
137        --mtime=DATE-OR-FILE   set mtime for added files from DATE-OR-FILE
138    -m, --touch                don't extract file modified time
139        --no-delay-directory-restore
140                               cancel the effect of --delay-directory-restore
141                               option
142        --no-same-owner        extract files as yourself (default for ordinary
143                               users)
144        --no-same-permissions  apply the user's umask when extracting permissions
145                               from the archive (default for ordinary users)
146        --numeric-owner        always use numbers for user/group names
147        --owner=NAME           force NAME as owner for added files
148        --owner-map=FILE       use FILE to map file owner UIDs and names
149    -p, --preserve-permissions, --same-permissions
150                               extract information about file permissions
151                               (default for superuser)
152        --same-owner           try extracting files with the same ownership as
153                               exists in the archive (default for superuser)
154        --sort=ORDER           directory sorting order: none (default), name or
155                               inode
156    -s, --preserve-order, --same-order
157                               member arguments are listed in the same order as
158                               the files in the archive
159  
160   Handling of extended file attributes:
161  
162        --acls                 Enable the POSIX ACLs support
163        --no-acls              Disable the POSIX ACLs support
164        --no-selinux           Disable the SELinux context support
165        --no-xattrs            Disable extended attributes support
166        --selinux              Enable the SELinux context support
167        --xattrs               Enable extended attributes support
168        --xattrs-exclude=MASK  specify the exclude pattern for xattr keys
169        --xattrs-include=MASK  specify the include pattern for xattr keys
170  
171   Device selection and switching:
172  
173        --force-local          archive file is local even if it has a colon
174    -f, --file=ARCHIVE         use archive file or device ARCHIVE
175    -F, --info-script=NAME, --new-volume-script=NAME
176                               run script at end of each tape (implies -M)
177    -L, --tape-length=NUMBER   change tape after writing NUMBER x 1024 bytes
178    -M, --multi-volume         create/list/extract multi-volume archive
179        --rmt-command=COMMAND  use given rmt COMMAND instead of rmt
180        --rsh-command=COMMAND  use remote COMMAND instead of rsh
181        --volno-file=FILE      use/update the volume number in FILE
182  
183   Device blocking:
184  
185    -b, --blocking-factor=BLOCKS   BLOCKS x 512 bytes per record
186    -B, --read-full-records    reblock as we read (for 4.2BSD pipes)
187    -i, --ignore-zeros         ignore zeroed blocks in archive (means EOF)
188        --record-size=NUMBER   NUMBER of bytes per record, multiple of 512
189  
190   Archive format selection:
191  
192    -H, --format=FORMAT        create archive of the given format
193  
194   FORMAT is one of the following:
195      gnu                      GNU tar 1.13.x format
196      oldgnu                   GNU format as per tar <= 1.12
197      pax                      POSIX 1003.1-2001 (pax) format
198      posix                    same as pax
199      ustar                    POSIX 1003.1-1988 (ustar) format
200      v7                       old V7 tar format
201  
202        --old-archive, --portability
203                               same as --format=v7
204        --pax-option=keyword[[:]=value][,keyword[[:]=value]]...
205                               control pax keywords
206        --posix                same as --format=posix
207    -V, --label=TEXT           create archive with volume name TEXT; at
208                               list/extract time, use TEXT as a globbing pattern
209                               for volume name
210  
211   Compression options:
212  
213    -a, --auto-compress        use archive suffix to determine the compression
214                               program
215    -I, --use-compress-program=PROG
216                               filter through PROG (must accept -d)
217    -j, --bzip2                filter the archive through bzip2
218    -J, --xz                   filter the archive through xz
219        --lzip                 filter the archive through lzip
220        --lzma                 filter the archive through lzma
221        --lzop                 filter the archive through lzop
222        --no-auto-compress     do not use archive suffix to determine the
223                               compression program
224        --zstd                 filter the archive through zstd
225    -z, --gzip, --gunzip, --ungzip   filter the archive through gzip
226    -Z, --compress, --uncompress   filter the archive through compress
227  
228   Local file selection:
229  
230        --backup[=CONTROL]     backup before removal, choose version CONTROL
231        --hard-dereference     follow hard links; archive and dump the files they
232                               refer to
233    -h, --dereference          follow symlinks; archive and dump the files they
234                               point to
235    -K, --starting-file=MEMBER-NAME
236                               begin at member MEMBER-NAME when reading the
237                               archive
238        --newer-mtime=DATE     compare date and time when data changed only
239    -N, --newer=DATE-OR-FILE, --after-date=DATE-OR-FILE
240                               only store files newer than DATE-OR-FILE
241        --one-file-system      stay in local file system when creating archive
242    -P, --absolute-names       don't strip leading '/'s from file names
243        --suffix=STRING        backup before removal, override usual suffix ('~'
244                               unless overridden by environment variable
245                               SIMPLE_BACKUP_SUFFIX)
246  
247   File name transformations:
248  
249        --strip-components=NUMBER   strip NUMBER leading components from file
250                               names on extraction
251        --transform=EXPRESSION, --xform=EXPRESSION
252                               use sed replace EXPRESSION to transform file
253                               names
254  
255   Informative output:
256  
257        --checkpoint[=NUMBER]  display progress messages every NUMBERth record
258                               (default 10)
259        --checkpoint-action=ACTION   execute ACTION on each checkpoint
260        --full-time            print file time to its full resolution
261        --index-file=FILE      send verbose output to FILE
262    -l, --check-links          print a message if not all links are dumped
263        --no-quote-chars=STRING   disable quoting for characters from STRING
264        --quote-chars=STRING   additionally quote characters from STRING
265        --quoting-style=STYLE  set name quoting style; see below for valid STYLE
266                               values
267    -R, --block-number         show block number within archive with each message
268                              
269        --show-defaults        show tar defaults
270        --show-omitted-dirs    when listing or extracting, list each directory
271                               that does not match search criteria
272        --show-snapshot-field-ranges
273                               show valid ranges for snapshot-file fields
274        --show-transformed-names, --show-stored-names
275                               show file or archive names after transformation
276        --totals[=SIGNAL]      print total bytes after processing the archive;
277                               with an argument - print total bytes when this
278                               SIGNAL is delivered; Allowed signals are: SIGHUP,
279                               SIGQUIT, SIGINT, SIGUSR1 and SIGUSR2; the names
280                               without SIG prefix are also accepted
281        --utc                  print file modification times in UTC
282    -v, --verbose              verbosely list files processed
283        --warning=KEYWORD      warning control
284    -w, --interactive, --confirmation
285                               ask for confirmation for every action
286  
287   Compatibility options:
288  
289    -o                         when creating, same as --old-archive; when
290                               extracting, same as --no-same-owner
291  
292   Other options:
293  
294    -?, --help                 give this help list
295        --restrict             disable use of some potentially harmful options
296        --usage                give a short usage message
297        --version              print program version
298  
299  Mandatory or optional arguments to long options are also mandatory or optional
300  for any corresponding short options.
301  
302  The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
303  The version control may be set with --backup or VERSION_CONTROL, values are:
304  
305    none, off       never make backups
306    t, numbered     make numbered backups
307    nil, existing   numbered if numbered backups exist, simple otherwise
308    never, simple   always make simple backups
309  
310  Valid arguments for the --quoting-style option are:
311  
312    literal
313    shell
314    shell-always
315    shell-escape
316    shell-escape-always
317    c
318    c-maybe
319    escape
320    locale
321    clocale
322  
323  *This* tar defaults to:
324  --format=gnu -f- -b20 --quoting-style=escape
325  --rmt-command=/nix/store/k1lcfin159706lihwx5hhvl80dbij4jw-gnutar-1.35/libexec/rmt