Debian Codegraph @

upstream/mageia-cauldron/man1/tar.1

raw
1 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33.
2 .TH TAR "1" "May 2026" "tar 1.35" "User Commands"
3 .SH NAME
4 A tar (tape archiver) program.
5 .SH SYNOPSIS
6 .B tar
7 [\fIOPTION\fR...] [\fIFILE\fR]...
8 .SH DESCRIPTION
9 GNU 'tar' saves many files together into a single tape or disk archive, and can
10 restore individual files from the archive.
11 .SH EXAMPLES
12 .TP
13 tar \fB\-cf\fR archive.tar foo bar
14 # Create archive.tar from files foo and bar.
15 .TP
16 tar \fB\-tvf\fR archive.tar
17 # List all files in archive.tar verbosely.
18 .TP
19 tar \fB\-xf\fR archive.tar
20 # Extract all files from archive.tar.
21 .IP
22 Main operation mode:
23 .TP
24 \fB\-A\fR, \fB\-\-catenate\fR, \fB\-\-concatenate\fR
25 append tar files to an archive
26 .TP
27 \fB\-c\fR, \fB\-\-create\fR
28 create a new archive
29 .TP
30 \fB\-\-delete\fR
31 delete from the archive (not on mag tapes!)
32 .TP
33 \fB\-d\fR, \fB\-\-diff\fR, \fB\-\-compare\fR
34 find differences between archive and file system
35 .TP
36 \fB\-r\fR, \fB\-\-append\fR
37 append files to the end of an archive
38 .TP
39 \fB\-\-test\-label\fR
40 test the archive volume label and exit
41 .TP
42 \fB\-t\fR, \fB\-\-list\fR
43 list the contents of an archive
44 .TP
45 \fB\-u\fR, \fB\-\-update\fR
46 only append files newer than copy in archive
47 .TP
48 \fB\-x\fR, \fB\-\-extract\fR, \fB\-\-get\fR
49 extract files from an archive
50 .IP
51 Operation modifiers:
52 .TP
53 \fB\-\-check\-device\fR
54 check device numbers when creating incremental
55 archives (default)
56 .TP
57 \fB\-g\fR, \fB\-\-listed\-incremental\fR=\fIFILE\fR
58 handle new GNU-format incremental backup
59 .TP
60 \fB\-G\fR, \fB\-\-incremental\fR
61 handle old GNU-format incremental backup
62 .TP
63 \fB\-\-hole\-detection\fR=\fITYPE\fR
64 technique to detect holes
65 .TP
66 \fB\-\-ignore\-failed\-read\fR
67 do not exit with nonzero on unreadable files
68 .TP
69 \fB\-\-level\fR=\fINUMBER\fR
70 dump level for created listed-incremental archive
71 .TP
72 \fB\-\-no\-check\-device\fR
73 do not check device numbers when creating
74 incremental archives
75 .TP
76 \fB\-\-no\-seek\fR
77 archive is not seekable
78 .TP
79 \fB\-n\fR, \fB\-\-seek\fR
80 archive is seekable
81 .TP
82 \fB\-\-occurrence\fR[=\fINUMBER\fR]
83 process only the NUMBERth occurrence of each file
84 in the archive; this option is valid only in
85 conjunction with one of the subcommands \fB\-\-delete\fR,
86 \fB\-\-diff\fR, \fB\-\-extract\fR or \fB\-\-list\fR and when a list of
87 files is given either on the command line or via
88 the \fB\-T\fR option; NUMBER defaults to 1
89 .TP
90 \fB\-\-sparse\-version\fR=\fIMAJOR[\fR.MINOR]
91 set version of the sparse format to use (implies
92 \fB\-\-sparse\fR)
93 .TP
94 \fB\-S\fR, \fB\-\-sparse\fR
95 handle sparse files efficiently
96 .IP
97 Local file name selection:
98 .TP
99 \fB\-\-add\-file\fR=\fIFILE\fR
100 add given FILE to the archive (useful if its name
101 starts with a dash)
102 .TP
103 \fB\-C\fR, \fB\-\-directory\fR=\fIDIR\fR
104 change to directory DIR
105 .TP
106 \fB\-\-exclude\fR=\fIPATTERN\fR
107 exclude files, given as a PATTERN
108 .TP
109 \fB\-\-exclude\-backups\fR
110 exclude backup and lock files
111 .TP
112 \fB\-\-exclude\-caches\fR
113 exclude contents of directories containing
114 CACHEDIR.TAG, except for the tag file itself
115 .TP
116 \fB\-\-exclude\-caches\-all\fR
117 exclude directories containing CACHEDIR.TAG
118 .TP
119 \fB\-\-exclude\-caches\-under\fR exclude everything under directories containing
120 CACHEDIR.TAG
121 .TP
122 \fB\-\-exclude\-ignore\fR=\fIFILE\fR
123 read exclude patterns for each directory from
124 FILE, if it exists
125 .TP
126 \fB\-\-exclude\-ignore\-recursive\fR=\fIFILE\fR
127 read exclude patterns for each directory and its
128 subdirectories from FILE, if it exists
129 .TP
130 \fB\-\-exclude\-tag\fR=\fIFILE\fR
131 exclude contents of directories containing FILE,
132 except for FILE itself
133 .HP
134 \fB\-\-exclude\-tag\-all\fR=\fIFILE\fR exclude directories containing FILE
135 .TP
136 \fB\-\-exclude\-tag\-under\fR=\fIFILE\fR
137 exclude everything under directories
138 containing FILE
139 .TP
140 \fB\-\-exclude\-vcs\fR
141 exclude version control system directories
142 .TP
143 \fB\-\-exclude\-vcs\-ignores\fR
144 read exclude patterns from the VCS ignore files
145 .TP
146 \fB\-\-no\-null\fR
147 disable the effect of the previous \fB\-\-null\fR option
148 .TP
149 \fB\-\-no\-recursion\fR
150 avoid descending automatically in directories
151 .TP
152 \fB\-\-no\-unquote\fR
153 do not unquote input file or member names
154 .TP
155 \fB\-\-no\-verbatim\-files\-from\fR \fB\-T\fR treats file names starting with dash as
156 options (default)
157 .TP
158 \fB\-\-null\fR \fB\-T\fR reads null-terminated names; implies
159 \fB\-\-verbatim\-files\-from\fR
160 .TP
161 \fB\-\-recursion\fR
162 recurse into directories (default)
163 .TP
164 \fB\-T\fR, \fB\-\-files\-from\fR=\fIFILE\fR
165 get names to extract or create from FILE
166 .TP
167 \fB\-\-unquote\fR
168 unquote input file or member names (default)
169 .TP
170 \fB\-\-verbatim\-files\-from\fR \fB\-T\fR reads file names verbatim (no escape or option
171 handling)
172 .TP
173 \fB\-X\fR, \fB\-\-exclude\-from\fR=\fIFILE\fR
174 exclude patterns listed in FILE
175 .IP
176 File name matching options (affect both exclude and include patterns):
177 .TP
178 \fB\-\-anchored\fR
179 patterns match file name start
180 .TP
181 \fB\-\-ignore\-case\fR
182 ignore case
183 .TP
184 \fB\-\-no\-anchored\fR
185 patterns match after any '/' (default for
186 exclusion)
187 .TP
188 \fB\-\-no\-ignore\-case\fR
189 case sensitive matching (default)
190 .TP
191 \fB\-\-no\-wildcards\fR
192 verbatim string matching
193 .TP
194 \fB\-\-no\-wildcards\-match\-slash\fR
195 wildcards do not match '/'
196 .TP
197 \fB\-\-wildcards\fR
198 use wildcards (default for exclusion)
199 .TP
200 \fB\-\-wildcards\-match\-slash\fR
201 wildcards match '/' (default for exclusion)
202 .IP
203 Overwrite control:
204 .TP
205 \fB\-\-keep\-directory\-symlink\fR
206 preserve existing symlinks to directories when
207 extracting
208 .TP
209 \fB\-\-keep\-newer\-files\fR
210 don't replace existing files that are newer than
211 their archive copies
212 .TP
213 \fB\-k\fR, \fB\-\-keep\-old\-files\fR
214 don't replace existing files when extracting,
215 treat them as errors
216 .TP
217 \fB\-\-no\-overwrite\-dir\fR
218 preserve metadata of existing directories
219 .TP
220 \fB\-\-one\-top\-level\fR[=\fIDIR\fR]
221 create a subdirectory to avoid having loose files
222 extracted
223 .TP
224 \fB\-\-overwrite\fR
225 overwrite existing files when extracting
226 .TP
227 \fB\-\-overwrite\-dir\fR
228 overwrite metadata of existing directories when
229 extracting (default)
230 .TP
231 \fB\-\-recursive\-unlink\fR
232 empty hierarchies prior to extracting directory
233 .TP
234 \fB\-\-remove\-files\fR
235 remove files after adding them to the archive
236 .TP
237 \fB\-\-skip\-old\-files\fR
238 don't replace existing files when extracting,
239 silently skip over them
240 .TP
241 \fB\-U\fR, \fB\-\-unlink\-first\fR
242 remove each file prior to extracting over it
243 .TP
244 \fB\-W\fR, \fB\-\-verify\fR
245 attempt to verify the archive after writing it
246 .IP
247 Select output stream:
248 .HP
249 \fB\-\-ignore\-command\-error\fR ignore exit codes of children
250 .TP
251 \fB\-\-no\-ignore\-command\-error\fR
252 treat non-zero exit codes of children as
253 error
254 .TP
255 \fB\-O\fR, \fB\-\-to\-stdout\fR
256 extract files to standard output
257 .TP
258 \fB\-\-to\-command\fR=\fICOMMAND\fR
259 pipe extracted files to another program
260 .IP
261 Handling of file attributes:
262 .TP
263 \fB\-\-atime\-preserve\fR[=\fIMETHOD\fR]
264 preserve access times on dumped files, either
265 by restoring the times after reading
266 (METHOD='replace'; default) or by not setting the
267 times in the first place (METHOD='system')
268 .TP
269 \fB\-\-clamp\-mtime\fR
270 only set time when the file is more recent than
271 what was given with \fB\-\-mtime\fR
272 .TP
273 \fB\-\-delay\-directory\-restore\fR
274 delay setting modification times and
275 permissions of extracted directories until the end
276 of extraction
277 .TP
278 \fB\-\-group\fR=\fINAME\fR
279 force NAME as group for added files
280 .TP
281 \fB\-\-group\-map\fR=\fIFILE\fR
282 use FILE to map file owner GIDs and names
283 .TP
284 \fB\-\-mode\fR=\fICHANGES\fR
285 force (symbolic) mode CHANGES for added files
286 .TP
287 \fB\-\-mtime\fR=\fIDATE\-OR\-FILE\fR
288 set mtime for added files from DATE-OR-FILE
289 .TP
290 \fB\-m\fR, \fB\-\-touch\fR
291 don't extract file modified time
292 .TP
293 \fB\-\-no\-delay\-directory\-restore\fR
294 cancel the effect of \fB\-\-delay\-directory\-restore\fR
295 option
296 .TP
297 \fB\-\-no\-same\-owner\fR
298 extract files as yourself (default for ordinary
299 users)
300 .TP
301 \fB\-\-no\-same\-permissions\fR
302 apply the user's umask when extracting permissions
303 from the archive (default for ordinary users)
304 .TP
305 \fB\-\-numeric\-owner\fR
306 always use numbers for user/group names
307 .TP
308 \fB\-\-owner\fR=\fINAME\fR
309 force NAME as owner for added files
310 .TP
311 \fB\-\-owner\-map\fR=\fIFILE\fR
312 use FILE to map file owner UIDs and names
313 .TP
314 \fB\-p\fR, \fB\-\-preserve\-permissions\fR, \fB\-\-same\-permissions\fR
315 extract information about file permissions
316 (default for superuser)
317 .TP
318 \fB\-\-same\-owner\fR
319 try extracting files with the same ownership as
320 exists in the archive (default for superuser)
321 .TP
322 \fB\-\-sort\fR=\fIORDER\fR
323 directory sorting order: none (default), name or
324 inode
325 .TP
326 \fB\-s\fR, \fB\-\-preserve\-order\fR, \fB\-\-same\-order\fR
327 member arguments are listed in the same order as
328 the files in the archive
329 .IP
330 Handling of extended file attributes:
331 .TP
332 \fB\-\-acls\fR
333 Enable the POSIX ACLs support
334 .TP
335 \fB\-\-no\-acls\fR
336 Disable the POSIX ACLs support
337 .TP
338 \fB\-\-no\-selinux\fR
339 Disable the SELinux context support
340 .TP
341 \fB\-\-no\-xattrs\fR
342 Disable extended attributes support
343 .TP
344 \fB\-\-selinux\fR
345 Enable the SELinux context support
346 .TP
347 \fB\-\-xattrs\fR
348 Enable extended attributes support
349 .TP
350 \fB\-\-xattrs\-exclude\fR=\fIMASK\fR
351 specify the exclude pattern for xattr keys
352 .TP
353 \fB\-\-xattrs\-include\fR=\fIMASK\fR
354 specify the include pattern for xattr keys
355 .IP
356 Device selection and switching:
357 .TP
358 \fB\-\-force\-local\fR
359 archive file is local even if it has a colon
360 .TP
361 \fB\-f\fR, \fB\-\-file\fR=\fIARCHIVE\fR
362 use archive file or device ARCHIVE
363 .TP
364 \fB\-F\fR, \fB\-\-info\-script\fR=\fINAME\fR, \fB\-\-new\-volume\-script\fR=\fINAME\fR
365 run script at end of each tape (implies \fB\-M\fR)
366 .TP
367 \fB\-L\fR, \fB\-\-tape\-length\fR=\fINUMBER\fR
368 change tape after writing NUMBER x 1024 bytes
369 .TP
370 \fB\-M\fR, \fB\-\-multi\-volume\fR
371 create/list/extract multi-volume archive
372 .TP
373 \fB\-\-rmt\-command\fR=\fICOMMAND\fR
374 use given rmt COMMAND instead of rmt
375 .TP
376 \fB\-\-rsh\-command\fR=\fICOMMAND\fR
377 use remote COMMAND instead of rsh
378 .TP
379 \fB\-\-volno\-file\fR=\fIFILE\fR
380 use/update the volume number in FILE
381 .IP
382 Device blocking:
383 .TP
384 \fB\-b\fR, \fB\-\-blocking\-factor\fR=\fIBLOCKS\fR
385 BLOCKS x 512 bytes per record
386 .TP
387 \fB\-B\fR, \fB\-\-read\-full\-records\fR
388 reblock as we read (for 4.2BSD pipes)
389 .TP
390 \fB\-i\fR, \fB\-\-ignore\-zeros\fR
391 ignore zeroed blocks in archive (means EOF)
392 .TP
393 \fB\-\-record\-size\fR=\fINUMBER\fR
394 NUMBER of bytes per record, multiple of 512
395 .IP
396 Archive format selection:
397 .TP
398 \fB\-H\fR, \fB\-\-format\fR=\fIFORMAT\fR
399 create archive of the given format
400 .IP
401 FORMAT is one of the following:
402 .TP
403 gnu
404 GNU tar 1.13.x format
405 .TP
406 oldgnu
407 GNU format as per tar <= 1.12
408 .TP
409 pax
410 POSIX 1003.1-2001 (pax) format
411 .TP
412 posix
413 same as pax
414 .TP
415 ustar
416 POSIX 1003.1-1988 (ustar) format
417 .TP
418 v7
419 old V7 tar format
420 .TP
421 \fB\-\-old\-archive\fR, \fB\-\-portability\fR
422 same as \fB\-\-format\fR=\fIv7\fR
423 .TP
424 \fB\-\-pax\-option\fR=\fIkeyword[[\fR:]=value][,keyword[[:]=value]]...
425 control pax keywords
426 .TP
427 \fB\-\-posix\fR
428 same as \fB\-\-format\fR=\fIposix\fR
429 .TP
430 \fB\-V\fR, \fB\-\-label\fR=\fITEXT\fR
431 create archive with volume name TEXT; at
432 list/extract time, use TEXT as a globbing pattern
433 for volume name
434 .IP
435 Compression options:
436 .TP
437 \fB\-a\fR, \fB\-\-auto\-compress\fR
438 use archive suffix to determine the compression
439 program
440 .TP
441 \fB\-I\fR, \fB\-\-use\-compress\-program\fR=\fIPROG\fR
442 filter through PROG (must accept \fB\-d\fR)
443 .TP
444 \fB\-j\fR, \fB\-\-bzip2\fR
445 filter the archive through bzip2
446 .TP
447 \fB\-J\fR, \fB\-\-xz\fR
448 filter the archive through xz
449 .TP
450 \fB\-\-lzip\fR
451 filter the archive through lzip
452 .TP
453 \fB\-\-lzop\fR
454 filter the archive through lzop
455 .TP
456 \fB\-\-no\-auto\-compress\fR
457 do not use archive suffix to determine the
458 compression program
459 .TP
460 \fB\-Y\fR, \fB\-\-lzma\fR
461 filter the archive through xz \fB\-\-format\fR=\fIlzma\fR
462 .TP
463 \fB\-\-zstd\fR
464 filter the archive through zstd
465 .TP
466 \fB\-z\fR, \fB\-\-gzip\fR, \fB\-\-gunzip\fR, \fB\-\-ungzip\fR
467 filter the archive through gzip
468 .TP
469 \fB\-Z\fR, \fB\-\-compress\fR, \fB\-\-uncompress\fR
470 filter the archive through compress
471 .IP
472 Local file selection:
473 .TP
474 \fB\-\-backup\fR[=\fICONTROL\fR]
475 backup before removal, choose version CONTROL
476 .TP
477 \fB\-\-hard\-dereference\fR
478 follow hard links; archive and dump the files they
479 refer to
480 .TP
481 \fB\-h\fR, \fB\-\-dereference\fR
482 follow symlinks; archive and dump the files they
483 point to
484 .TP
485 \fB\-K\fR, \fB\-\-starting\-file\fR=\fIMEMBER\-NAME\fR
486 begin at member MEMBER-NAME when reading the
487 archive
488 .TP
489 \fB\-\-newer\-mtime\fR=\fIDATE\fR
490 compare date and time when data changed only
491 .TP
492 \fB\-N\fR, \fB\-\-newer\fR=\fIDATE\-OR\-FILE\fR, \fB\-\-after\-date\fR=\fIDATE\-OR\-FILE\fR
493 only store files newer than DATE-OR-FILE
494 .TP
495 \fB\-\-one\-file\-system\fR
496 stay in local file system when creating archive
497 .TP
498 \fB\-P\fR, \fB\-\-absolute\-names\fR
499 don't strip leading '/'s from file names
500 .TP
501 \fB\-\-suffix\fR=\fISTRING\fR
502 backup before removal, override usual suffix ('~'
503 unless overridden by environment variable
504 SIMPLE_BACKUP_SUFFIX)
505 .IP
506 File name transformations:
507 .TP
508 \fB\-\-strip\-components\fR=\fINUMBER\fR
509 strip NUMBER leading components from file
510 names on extraction
511 .TP
512 \fB\-\-transform\fR=\fIEXPRESSION\fR, \fB\-\-xform\fR=\fIEXPRESSION\fR
513 use sed replace EXPRESSION to transform file
514 names
515 .IP
516 Informative output:
517 .TP
518 \fB\-\-checkpoint\fR[=\fINUMBER\fR]
519 display progress messages every NUMBERth record
520 (default 10)
521 .TP
522 \fB\-\-checkpoint\-action\fR=\fIACTION\fR
523 execute ACTION on each checkpoint
524 .TP
525 \fB\-\-full\-time\fR
526 print file time to its full resolution
527 .TP
528 \fB\-\-index\-file\fR=\fIFILE\fR
529 send verbose output to FILE
530 .TP
531 \fB\-l\fR, \fB\-\-check\-links\fR
532 print a message if not all links are dumped
533 .TP
534 \fB\-\-no\-quote\-chars\fR=\fISTRING\fR
535 disable quoting for characters from STRING
536 .TP
537 \fB\-\-quote\-chars\fR=\fISTRING\fR
538 additionally quote characters from STRING
539 .TP
540 \fB\-\-quoting\-style\fR=\fISTYLE\fR
541 set name quoting style; see below for valid STYLE
542 values
543 .TP
544 \fB\-R\fR, \fB\-\-block\-number\fR
545 show block number within archive with each message
546 .TP
547 \fB\-\-show\-defaults\fR
548 show tar defaults
549 .TP
550 \fB\-\-show\-omitted\-dirs\fR
551 when listing or extracting, list each directory
552 that does not match search criteria
553 .TP
554 \fB\-\-show\-snapshot\-field\-ranges\fR
555 show valid ranges for snapshot-file fields
556 .TP
557 \fB\-\-show\-transformed\-names\fR, \fB\-\-show\-stored\-names\fR
558 show file or archive names after transformation
559 .TP
560 \fB\-\-totals\fR[=\fISIGNAL\fR]
561 print total bytes after processing the archive;
562 with an argument - print total bytes when this
563 SIGNAL is delivered; Allowed signals are: SIGHUP,
564 SIGQUIT, SIGINT, SIGUSR1 and SIGUSR2; the names
565 without SIG prefix are also accepted
566 .TP
567 \fB\-\-utc\fR
568 print file modification times in UTC
569 .TP
570 \fB\-v\fR, \fB\-\-verbose\fR
571 verbosely list files processed
572 .TP
573 \fB\-\-warning\fR=\fIKEYWORD\fR
574 warning control
575 .TP
576 \fB\-w\fR, \fB\-\-interactive\fR, \fB\-\-confirmation\fR
577 ask for confirmation for every action
578 .IP
579 Compatibility options:
580 .TP
581 \fB\-o\fR
582 when creating, same as \fB\-\-old\-archive\fR; when
583 extracting, same as \fB\-\-no\-same\-owner\fR
584 .IP
585 Other options:
586 .TP
587 -?, \fB\-\-help\fR
588 give this help list
589 .TP
590 \fB\-\-restrict\fR
591 disable use of some potentially harmful options
592 .TP
593 \fB\-\-usage\fR
594 give a short usage message
595 .TP
596 \fB\-\-version\fR
597 print program version
598 .PP
599 Mandatory or optional arguments to long options are also mandatory or optional
600 for any corresponding short options.
601 .PP
602 The backup suffix is '~', unless set with \fB\-\-suffix\fR or SIMPLE_BACKUP_SUFFIX.
603 The version control may be set with \fB\-\-backup\fR or VERSION_CONTROL, values are:
604 .TP
605 none, off
606 never make backups
607 .TP
608 t, numbered
609 make numbered backups
610 .TP
611 nil, existing
612 numbered if numbered backups exist, simple otherwise
613 .TP
614 never, simple
615 always make simple backups
616 .PP
617 Valid arguments for the \fB\-\-quoting\-style\fR option are:
618 .IP
619 literal
620 shell
621 shell-always
622 shell-escape
623 shell-escape-always
624 c
625 c-maybe
626 escape
627 locale
628 clocale
629 .PP
630 *This* tar defaults to:
631 \fB\-\-format\fR=\fIgnu\fR \fB\-f\-\fR \fB\-b20\fR \fB\-\-quoting\-style\fR=\fIescape\fR \fB\-\-rmt\-command=\fR/usr/sbin/rmt
632 \fB\-\-rsh\-command=\fR/usr/bin/ssh
633 .SH AUTHOR
634 Written by John Gilmore and Jay Fenlason.
635 .SH COPYRIGHT
636 Copyright \(co 2023 Free Software Foundation, Inc.
637 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
638 .br
639 This is free software: you are free to change and redistribute it.
640 There is NO WARRANTY, to the extent permitted by law.
641 .SH "SEE ALSO"
642 The full documentation for
643 .B tar
644 is maintained as a Texinfo manual. If the
645 .B info
646 and
647 .B tar
648 programs are properly installed at your site, the command
649 .IP
650 .B info tar
651 .PP
652 should give you access to the complete manual.