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