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