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