forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tar.1
813 lines (810 loc) · 16.4 KB
/
tar.1
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
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
.TH TAR 1 "Mar 2010" "GNU" "tar"
.SH NAME
tar \- The GNU version of the tape archiver (tar) utility
.SH SYNOPSIS
.B tar
.I <operation> [options]
.I Operations:
.nf
.B [-]A --catenate --concatenate
.B [-]c --create
.B [-]d --diff --compare
.B [-]r --append
.B [-]t --list
.B [-]u --update
.B [-]x --extract --get
.B --delete
.fi
.I Common Options:
.nf
.BR -C ", " --directory " DIR"
.BR -f ", " --file " FILE"
.BR -j ", " --bzip2
.BR -J ", " --xz
.BR -p ", " --preserve-permissions
.BR -v ", " --verbose
.BR -z ", " --gzip
.fi
.I All Options:
.br
[
.BR -a ", " --auto-compress
]
[
.BR --add-file " FILE"
]
[
.BR --anchored
]
[
.BR --atime-preserve
]
[
.BR -b ", " --blocking-factor " N"
]
[
.BR -B ", " --read-full-records
]
[
.BR --backup " BACKUP-TYPE"
]
[
.BR --block-compress
]
[
.BR -C ", " --directory " DIR"
]
[
.BR --checkpoint
]
[
.BR --delay-directory-restore
]
[
.BR --exclude " PATTERN"
]
[
.BR --exclude-caches
]
[
.BR --exclude-caches-all
]
[
.BR --exclude-caches-under
]
[
.BR --exclude-tag " FILE"
]
[
.BR --exclude-tag-all " FILE"
]
[
.BR --exclude-tag-under " FILE"
]
[
.BR -f ", " --file " [HOSTNAME:]FILE"
]
[
.BR -F ", " --info-script " FILE, " --new-volume-script " FILE"
]
[
.BR --force-local
]
[
.BR --format " FORMAT"
]
[
.BR -g ", " --listed-incremental " SNAPSHOT"
]
[
.BR -G ", " --incremental
]
[
.BR --group " GROUP"
]
[
.BR -h ", " --dereference
]
[
.BR --help
]
[
.BR -i ", " --ignore-zeros
]
[
.BR -I ", " --use-compress-program " PROG"
]
[
.BR --ignore-case
]
[
.BR --ignore-command-error
]
[
.BR --ignore-failed-read
]
[
.BR --index-file " FILE"
]
[
.BR -j ", " --bzip2
]
[
.BR -J ", " --xz
]
[
.BR -k ", " --keep-old-files
]
[
.BR -K ", " --starting-file " FILE"
]
[
.BR --keep-newer-files
]
[
.BR -l ", " --check-links
]
[
.BR -L ", " --tape-length " N"
]
[
.BR --lzip
]
[
.BR --lzma
]
[
.BR --lzop
]
[
.BR -m ", " --touch ", " --modification-time
]
[
.BR -M ", " --multi-volume
]
[
.BR --mode " PERMISSIONS"
]
[
.BR --mtime " DATE"
]
[
.BR -N ", " --after-date " DATE, " --newer " DATE"
]
[
.BR --newer-mtime " DATE"
]
[
.BR --no-anchored
]
[
.BR --no-auto-compress
]
[
.BR --no-delay-directory-restore
]
[
.BR --no-ignore-case
]
[
.BR --no-ignore-command-error
]
[
.BR --no-overwrite-dir
]
[
.BR --no-quote-chars
]
[
.BR --no-recursion
]
[
.BR --no-same-permissions
]
[
.BR --no-unquote
]
[
.BR --no-wildcards
]
[
.BR --no-wildcards-match-slash
]
[
.BR --null
]
[
.BR --numeric-owner
]
[
.BR -o ", " --old-archive ", " --portability ", " --no-same-owner
]
[
.BR -O ", " --to-stdout
]
[
.BR --occurrence " NUM"
]
[
.BR --one-file-system
]
[
.BR --overwrite
]
[
.BR --overwrite-dir
]
[
.BR --owner " USER"
]
[
.BR -p ", " --same-permissions ", " --preserve-permissions
]
[
.BR -P ", " --absolute-names
]
[
.BR --pax-option " KEYWORD-LIST"
]
[
.BR --posix
]
[
.BR --preserve
]
[
.BR --quote-chars " STRING"
]
[
.BR --quote-style " STYLE"
]
[
.BR -R ", " --block-number
]
[
.BR --record-size " SIZE"
]
[
.BR --recursion
]
[
.BR --recursive-unlink
]
[
.BR --remove-files
]
[
.BR --restrict
]
[
.BR --rmt-command " CMD"
]
[
.BR --rsh-command " CMD"
]
[
.BR -s ", " --same-order ", " --preserve-order
]
[
.BR -S ", " --sparse
]
[
.BR --same-owner
]
[
.BR --show-defaults
]
[
.BR --show-omitted-dirs
]
[
.BR --show-transformed-names ", " --show-stored-names
]
[
.BR --strip-components " NUMBER"
]
[
.BR --suffix " SUFFIX"
]
[
.BR -T ", " --files-from " FILE"
]
[
.BR --test-label
]
[
.BR --to-command " COMMAND"
]
[
.BR --transform " EXPRESSION"
]
[
.BR --totals
]
[
.BR -U ", " --unlink-first
]
[
.BR --unquote
]
[
.BR --utc
]
[
.BR -v ", " --verbose
]
[
.BR -V ", " --label " NAME"
]
[
.BR --version
]
[
.BR --volno-file " FILE"
]
[
.BR -w ", " --interactive ", " --confirmation
]
[
.BR -W ", " --verify
]
[
.BR --wildcards
]
[
.BR --wildcards-match-slash
]
[
.BR -X ", " --exclude-from " FILE"
]
[
.BR -z ", " --gzip ", " --gunzip ", " --ungzip
]
[
.BR -Z ", " --compress ", " --uncompress
]
[
.BR -[0-7][lmh]
]
.SH DESCRIPTION
This manual page documents the GNU version of \fBtar\fR, an archiving
program designed to store and extract files from an archive file known
as a \fItarfile\fR. A \fItarfile\fR may be made on a tape drive,
however, it is also common to write a \fItarfile\fR to a normal file.
The first argument to \fBtar\fR must be one of the options \fBAcdrtux\fR,
followed by any optional functions. The final arguments to \fBtar\fR
are the names of the files or directories which should be archived. The
use of a directory name always implies that the subdirectories below
should be included in the archive.
.SH EXAMPLES
.TP
.B tar -xvf foo.tar
verbosely extract foo.tar
.TP
.B tar -xzf foo.tar.gz
extract gzipped foo.tar.gz
.TP
.B tar -cjf foo.tar.bz2 bar/
create bzipped tar archive of the directory bar called foo.tar.bz2
.TP
.B tar -xjf foo.tar.bz2 -C bar/
extract bzipped foo.tar.bz2 after changing directory to bar
.TP
.B tar -xzf foo.tar.gz blah.txt
extract the file blah.txt from foo.tar.gz
.P
Note: When working with archives, specifying the compression option is often
times unnecessary as \fBtar\fR will automatically detect the compression type
based on the suffix of the archive.
.SH "FUNCTION LETTERS"
.TP
.B One of the following options must be used:
.TP
.BR -A ", " --catenate ", " --concatenate
append tar files to an archive
.TP
.BR -c ", " --create
create a new archive
.TP
.BR -d ", " --diff ", " --compare
find differences between archive and file system
.TP
.BR -r ", " --append
append files to the end of an archive
.TP
.BR -t ", " --list
list the contents of an archive
.TP
.BR -u ", " --update
only append files that are newer than the existing in archive
.TP
.BR -x ", " --extract ", " --get
extract files from an archive
.TP
.BR --delete
delete from the archive (not for use on magnetic tapes!)
.SH "COMMON OPTIONS"
.TP
.BR -C ", " --directory " DIR"
change to directory DIR
.TP
.BR -f ", " --file " [HOSTNAME:]FILE"
use archive file or device FILE (default is "-", meaning stdin/stdout)
.TP
.BR -j ", " --bzip2
filter archive through bzip2; use to decompress .bz2 files
.TP
.BR -J ", " --xz
filter archive through xz; use to decompress .xz files
.TP
.BR -p ", " --preserve-permissions
extract all protection information
.TP
.BR -v ", " --verbose
verbosely list files processed
.TP
.BR -z ", " --gzip ", " --ungzip
filter the archive through gzip
.SH "ALL OPTIONS"
.TP
.BR -a ", " --auto-compress
use archive suffix to determine the compression program
.TP
.BR --add-file " FILE"
add specified FILE to the archive (useful if FILE starts with a dash)
.TP
.BR --anchored
patterns will match the start of file names
.TP
.BR --atime-preserve
don't change access times of files that are archived
.TP
.BR -b ", " --blocking-factor " N"
block size of Nx512 bytes (default N=20)
.TP
.BR -B ", " --read-full-blocks
reblock as we read (for reading 4.2BSD pipes)
.TP
.BR --backup " BACKUP-TYPE"
backup files instead of deleting them using BACKUP-TYPE simple or
numbered
.TP
.BR --block-compress
block the output of compression program for tapes
.TP
.BR -C ", " --directory " DIR"
change to directory DIR
.TP
.BR --checkpoint
print directory names while reading the archive
.TP
.BR --delay-directory-restore
delay setting modification times and permissions of extracted directories
until the end of extraction
.TP
.BR --exclude " PATTERN"
exclude files based upon PATTERN
.TP
.BR --exclude-caches
exclude directories that contain a cache directory tag
.TP
.BR --exclude-tag " FILE"
exclude directories that contain a file named FILE
.TP
.BR -f ", " --file " [HOSTNAME:]FILE"
use archive file or device FILE (default "-", meaning stdin/stdout)
.TP
.BR -F ", " --info-script " FILE, " --new-volume-script " FILE"
run script at end of each tape (implies \fI--multi-volume\fR)
.TP
.BR --force-local
archive file is local even if its name contains a colon
.TP
.BR --format " FORMAT"
selects the format of the created archive
.nf
\fIv7\fR - Unix V7
\fIoldgnu\fR - GNU tar <=1.12
\fIgnu\fR - GNU tar 1.13
\fIustar\fR - POSIX.1-1988
\fIposix\fR - POSIX.1-2001
.fi
.TP
.BR -g ", " --listed-incremental " SNAPSHOT"
create/list/extract new GNU-format incremental backup
.TP
.BR --group " GROUP"
give files added to the archive a group id of GROUP instead of the group id
of the source file; this option does not affect extraction
.TP
.BR -G ", " --incremental
create/list/extract old GNU-format incremental backup
.TP
.BR -h ", " --dereference
don't archive symlinks; archive the files they point to
.TP
.BR --help
like this manpage, but not as cool
.TP
.BR -i ", " --ignore-zeros
ignore blocks of zeros in archive (normally mean EOF)
.TP
.BR -I ", " --use-compress-program " PROG"
access the archive through PROG (which is generally a compression program;
it must accept the \fI-d\fR option)
.TP
.BR --ignore-case
ignore case when excluding files
.TP
.BR --ignore-command-error
ignore exit codes of subprocesses
.TP
.BR --ignore-failed-read
don't exit with non-zero status on unreadable files
.TP
.BR --index-file " FILE"
send verbose output to FILE instead of stdout
.TP
.BR -j ", " --bzip2
filter archive through bzip2, use to decompress .bz2 files
.TP
.BR -J ", " --xz
filter archive through xz; use to decompress .xz files
.TP
.BR -k ", " --keep-old-files
keep existing files; don't overwrite them from archive
.TP
.BR -K ", " --starting-file " FILE"
begin at file FILE in the archive
.TP
.BR --keep-newer-files
do not overwrite files which are newer than the archive
.TP
.BR -l ", " --check-links
warn if number of hard links to the file on the filesystem mismatchs
the number of links recorded in the archive
.TP
.BR -L ", " --tape-length " N"
change tapes after writing N*1024 bytes
.TP
.BR -m ", " --touch ", " --modification-time
don't extract file modified time
.TP
.BR -M ", " --multi-volume
create/list/extract multi-volume archive
.TP
.BR --mode " PERMISSIONS"
apply PERMISSIONS while adding files (see \fBchmod\fR(1))
.TP
.BR --mtime " DATE"
when creating archives, use DATE as the modification time of the members,
instead of their actual modification times
.TP
.BR -N ", " --after-date " DATE, " --newer " DATE"
only store files that were modified or had status updates (permissions,
ACLs, extended attributes, ...) since DATE
.TP
.BR --newer-mtime " DATE"
like \fI--newer\fR, but only store files that were modified since DATE
.TP
.BR --no-anchored
match any subsequenceof the name's components with \fI--exclude\fR
.TP
.BR --no-auto-compress
do not use archive suffix to determine the compression program
.TP
.BR --no-delay-directory-restore
modification times and permissions of extracted directories are set when
all files from this directory have been extracted; this is the default
.TP
.BR --no-ignore-command-error
print warnings about subprocesses that terminated with a non-zero exit code
.TP
.BR --no-ignore-case
use case-sensitive matching with \fI--exclude\fR
.TP
.BR --no-overwrite-dir
preserve metadata of existing directories when extracting files from an
archive
.TP
.BR --no-quote-chars " STRING"
remove characters listed in STRING from the list of quoted characters
set by a previous \fI--quote-chars\fR option
.TP
.BR --no-recursion
don't recurse into directories
.TP
.BR --no-same-permissions
apply user's umask when extracting files instead of recorded permissions
.TP
.BR --no-unquote
treat all input file or member names literally, do not interpret
escape sequences
.TP
.BR --no-wildcards
don't use wildcards with \fI--exclude\fR
.TP
.BR --no-wildcards-match-slash
wildcards do not match slashes (/) with \fI--exclude\fR
.TP
.BR --null
\fI--files-from\fR reads null-terminated names, disable \fI--directory\fR
.TP
.BR --numeric-owner
always use numbers for user/group names
.TP
.BR -o ", " --old-archive ", " --portability
like \fI--format=v7\fR; \fI-o\fR exhibits this behavior when creating an
archive (deprecated behavior)
.TP
.BR -o ", " --no-same-owner
do not attempt to restore ownership when extracting; \fI-o\fR exhibits
this behavior when extracting an archive
.TP
.BR -O ", " --to-stdout
extract files to standard output
.TP
.BR --occurrence " NUM"
process only NUM occurrences of each named file; used with
\fI--delete\fR, \fI--diff\fR, \fI--extract\fR, or \fI--list\fR
.TP
.BR --one-file-system
stay in local file system when creating an archive
.TP
.BR --overwrite
overwrite existing files and directory metadata when extracting
.TP
.BR --overwrite-dir
overwrite directory metadata when extracting
.TP
.BR --owner " USER"
give files added to the archive a user id of USER instead of the user id
of the source file; this option does not affect extraction
.TP
.BR -p ", " --preserve-permissions ", " --same-permissions
extract all protection information
.TP
.BR -P ", " --absolute-names
don't strip leading `/'s from file names
.TP
.BR --pax-option " KEYWORD-LIST"
used only with POSIX.1-2001 archives to modify the way \fBtar\fR handles
extended header keywords
.TP
.BR --posix
like \fI--format=posix\fR
.TP
.BR --preserve
like \fI--preserve-permissions\fR plus \fI--same-order\fR
.TP
.BR --quote-chars " STRING"
always quote the characters from STRING, even if the selected quoting
style would not quote them
.TP
.BR --quote-style " STYLE"
set the quoting style to be used when printing member and file names
.TP
.BR -R ", " --record-number
show record number within archive with each message
.TP
.BR --record-size " SIZE"
use SIZE bytes per record when accessing archives
.TP
.BR --recursion
recurse into directories
.TP
.BR --recursive-unlink
remove existing directories before extracting directories of the same name
.TP
.BR --remove-files
remove files after adding them to the archive
.TP
.BR --restrict
disable the use of some potentially harmful options; currently this
disables shell invocation from the multi-volume menu
.TP
.BR --rmt-command " CMD"
use CMD instead of the default /usr/sbin/rmt
.TP
.BR --rsh-command " CMD"
use remote CMD instead of \fBrsh\fR(1)
.TP
.BR -s ", " --same-order ", " --preserve-order
list of names to extract is sorted to match archive
.TP
.BR -S ", " --sparse
handle sparse files efficiently
.TP
.BR --same-owner
create extracted files with the same ownership
.TP
.BR --show-defaults
display the default options used by \fBtar\fR
.TP
.BR --show-omitted-dirs
print directories \fBtar\fR skips while operating on an archive
.TP
.BR --show-transformed-names ", " --show-stored-names
display file or member names after applying any \fBsed\fR transformations
.TP
.BR --strip-components " NUMBER"
strip NUMBER of leading path components from file names before extraction
.TP
.BR --suffix " SUFFIX"
use SUFFIX instead of default '~' when backing up files
.TP
.BR -T ", " --files-from " FILE"
get names to extract or create from file FILE
.TP
.BR --test-label
read the volume label; if an argument is specified, test whether it
matches the volume label
.TP
.BR --to-command " COMMAND"
during extraction, pipe extracted files to the standard input of COMMAND
.TP
.BR --totals
print total bytes written with --create
.TP
.BR --transform " EXPRESSION"
transform file or member names using the \fBsed\fR replacement expression
EXPRESSION
.TP
.BR -U ", " --unlink-first
remove existing files before extracting files of the same name
.TP
.BR --unquote
enable unquoting input file or member names; this is the default
.TP
.BR --utc
display file modification dates in UTC
.TP
.BR -v ", " --verbose
verbosely list files processed
.TP
.BR -V ", " --label " NAME"
create archive with volume name NAME
.TP
.BR --version
print \fBtar\fR program version number
.TP
.BR --volno-file " FILE"
keep track of which volume of a multi-volume archive its working in
FILE; used with \fI--multi-volume\fR
.TP
.BR -w ", " --interactive ", " --confirmation
ask for confirmation for every action
.TP
.BR -W ", " --verify
attempt to verify the archive after writing it
.TP
.BR --wildcards
use wildcards with \fI--exclude\fR
.TP
.BR --wildcards-match-slash
wildcards match slashes (/) with \fI--exclude\fR
.TP
.BR -X ", " --exclude-from " FILE"
exclude files listed in FILE
.TP
.BR -z ", " --gzip ", " --gunzip ", " --ungzip
filter the archive through gzip
.TP
.BR -Z ", " --compress ", " --uncompress
filter the archive through compress
.TP
.BR -[0-7][lmh]
specify drive and density
.SH BUGS
The GNU folks, in general, abhor man pages and create info documents instead.
The maintainer of \fBtar\fR falls into this category. Thus, this man page may
not be complete nor current, and it is included in the Gentoo portage tree
because man is a great tool :). This man page was first taken from Debian
Linux and has since been lovingly updated here.
.SH "REPORTING BUGS"
Please report bugs via http://bugs.gentoo.org/
.SH "AUTHORS"
.nf
Debian Linux http://www.debian.org/
Mike Frysinger <[email protected]>
.fi