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