1TAR(1) tar TAR(1)
2
3
4
6 tar - The GNU version of the tar archiving utility
7
9 tar <operation> [options]
10
11 Operations:
12 [-]A --catenate --concatenate
13 [-]c --create
14 [-]d --diff --compare
15 [-]r --append
16 [-]t --list
17 [-]u --update
18 [-]x --extract --get
19 --delete
20
21 Common Options:
22 -C, --directory DIR
23 -f, --file F
24 -j, --bzip2
25 -p, --preserve-permissions
26 -v, --verbose
27 -z, --gzip
28
29 All Options:
30 [ --atime-preserve ] [ -b, --blocking-factor N ] [ -B, --read-full-
31 records ] [ --backup BACKUP-TYPE ] [ --block-compress ] [ -C, --direc‐
32 tory DIR ] [ --check-links ] [ --checkpoint ] [ -f, --file [HOSTNAME:]F
33 ] [ -F, --info-script F --new-volume-script F ] [ --force-local ] [
34 --format FORMAT ] [ -g, --listed-incremental F ] [ -G, --incremental ]
35 [ --group GROUP ] [ -h, --dereference ] [ --help ] [ -i, --ignore-zeros
36 ] [ --ignore-case ] [ --ignore-failed-read ] [ --index-file FILE ] [
37 -j, --bzip2 ] [ -k, --keep-old-files ] [ -K, --starting-file F ] [
38 --keep-newer-files ] [ -l, --one-file-system ] [ -L, --tape-length N ]
39 [ -m, --touch, --modification-time ] [ -M, --multi-volume ] [ --mode
40 PERMISSIONS ] [ -N, --after-date DATE, --newer DATE ] [ --newer-mtime
41 DATE ] [ --no-anchored ] [ --no-ignore-case ] [ --no-recursion ] [
42 --no-same-permissions ] [ --no-wildcards ] [ --no-wildcards-match-slash
43 ] [ --null ] [ --numeric-owner ] [ -o, --old-archive, --portabil‐
44 ity, --no-same-owner ] [ -O, --to-stdout ] [ --occurrence NUM ] [
45 --overwrite ] [ --overwrite-dir ] [ --owner USER ] [ -p, --same-permis‐
46 sions, --preserve-permissions ] [ -P, --absolute-names ] [ --pax-option
47 KEYWORD-LIST ] [ --posix ] [ --preserve ] [ --acls ] [ --selinux ] [
48 --xattrs ] [ --no-acls ] [ --no-selinux ] [ --no-xattrs ] [ -R,
49 --block-number ] [ --record-size SIZE ] [ --recursion ] [ --recursive-
50 unlink ] [ --remove-files ] [ --rmt-command CMD ] [ --rsh-command CMD ]
51 [ -s, --same-order, --preserve-order ] [ -S, --sparse ] [ --same-owner
52 ] [ --show-defaults ] [ --show-omitted-dirs ] [ --strip-components NUM‐
53 BER, --strip-path NUMBER (1) ] [ --suffix SUFFIX ] [ -T, --files-from F
54 ] [ --totals ] [ -U, --unlink-first ] [ --use-compress-program PROG ]
55 [ --utc ] [ -v, --verbose ] [ -V, --label NAME ] [ --version ] [
56 --volno-file F ] [ -w, --interactive, --confirmation ] [ -W, --verify ]
57 [ --wildcards ] [ --wildcards-match-slash ] [ --exclude PATTERN ] [ -X,
58 --exclude-from FILE ] [ -Z, --compress, --uncompress ] [ -z, --gzip,
59 --gunzip, --ungzip ] [ -[0-7][lmh] ]
60
61 (1) tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-components
62
64 This manual page documents the GNU version of tar, an archiving program
65 designed to store and extract files from an archive file known as a
66 tarfile. A tarfile may be made on a tape drive, however, it is also
67 common to write a tarfile to a normal file. The first argument to tar
68 must be one of the options Acdrtux, followed by any optional functions.
69 The final arguments to tar are the names of the files or directories
70 which should be archived. The use of a directory name always implies
71 that the subdirectories below should be included in the archive.
72
74 tar -xvf foo.tar
75 verbosely extract foo.tar
76
77 tar -xzf foo.tar.gz
78 extract gzipped foo.tar.gz
79
80 tar -cjf foo.tar.bz2 bar/
81 create bzipped tar archive of the directory bar called
82 foo.tar.bz2
83
84 tar -xjf foo.tar.bz2 -C bar/
85 extract bzipped foo.tar.bz2 after changing directory to bar
86
87 tar -xzf foo.tar.gz blah.txt
88 extract the file blah.txt from foo.tar.gz
89
91 One of the following options must be used:
92
93 -A, --catenate, --concatenate
94 append tar files to an archive
95
96 -c, --create
97 create a new archive
98
99 -d, --diff, --compare
100 find differences between archive and file system
101
102 -r, --append
103 append files to the end of an archive
104
105 -t, --list
106 list the contents of an archive
107
108 -u, --update
109 only append files that are newer than the existing in archive
110
111 -x, --extract, --get
112 extract files from an archive
113
114 --delete
115 delete from the archive (not for use on mag tapes!)
116
118 -C, --directory DIR
119 change to directory DIR
120
121 -f, --file [HOSTNAME:]F
122 use archive file or device F (default "-", meaning stdin/stdout)
123
124 -j, --bzip2
125 filter archive through bzip2, use to decompress .bz2 files
126
127 -p, --preserve-permissions
128 extract all protection information
129
130 -v, --verbose
131 verbosely list files processed
132
133 -z, --gzip, --ungzip
134 filter the archive through gzip
135
137 --atime-preserve
138 don't change access times on dumped files
139
140 -b, --blocking-factor N
141 block size of Nx512 bytes (default N=20)
142
143 -B, --read-full-blocks
144 reblock as we read (for reading 4.2BSD pipes)
145
146 --backup BACKUP-TYPE
147 backup files instead of deleting them using BACKUP-TYPE simple
148 or numbered
149
150 --block-compress
151 block the output of compression program for tapes
152
153 -C, --directory DIR
154 change to directory DIR
155
156 --check-links
157 warn if number of hard links to the file on the filesystem mis‐
158 match the number of links recorded in the archive
159
160 --checkpoint
161 print directory names while reading the archive
162
163 -f, --file [HOSTNAME:]F
164 use archive file or device F (default "-", meaning stdin/stdout)
165
166 -F, --info-script F --new-volume-script F
167 run script at end of each tape (implies --multi-volume)
168
169 --force-local
170 archive file is local even if has a colon
171
172 --format FORMAT
173 selects output archive format
174 v7 - Unix V7
175 oldgnu - GNU tar <=1.12
176 gnu - GNU tar 1.13
177 ustar - POSIX.1-1988
178 posix - POSIX.1-2001
179
180 -g, --listed-incremental F
181 create/list/extract new GNU-format incremental backup
182
183 -G, --incremental
184 create/list/extract old GNU-format incremental backup
185
186 -h, --dereference
187 don't dump symlinks; dump the files they point to
188
189 --help like this manpage, but not as cool
190
191 -i, --ignore-zeros
192 ignore blocks of zeros in archive (normally mean EOF)
193
194 --ignore-case
195 ignore case when excluding files
196
197 --ignore-failed-read
198 don't exit with non-zero status on unreadable files
199
200 --index-file FILE
201 send verbose output to FILE instead of stdout
202
203 -j, --bzip2
204 filter archive through bzip2, use to decompress .bz2 files
205
206 -k, --keep-old-files
207 keep existing files; don't overwrite them from archive
208
209 -K, --starting-file F
210 begin at file F in the archive
211
212 --keep-newer-files
213 do not overwrite files which are newer than the archive
214
215 -l, --one-file-system
216 stay in local file system when creating an archive
217
218 -L, --tape-length N
219 change tapes after writing N*1024 bytes
220
221 -m, --touch, --modification-time
222 don't extract file modified time
223
224 -M, --multi-volume
225 create/list/extract multi-volume archive
226
227 --mode PERMISSIONS
228 apply PERMISSIONS while adding files (see chmod(1))
229
230 -N, --after-date DATE, --newer DATE
231 only store files newer than DATE
232
233 --newer-mtime DATE
234 like --newer, but with a DATE
235
236 --no-anchored
237 match any subsequenceof the name's components with --exclude
238
239 --no-ignore-case
240 use case-sensitive matching with --exclude
241
242 --no-recursion
243 don't recurse into directories
244
245 --no-same-permissions
246 apply user's umask when extracting files instead of recorded
247 permissions
248
249 --no-wildcards
250 don't use wildcards with --exclude
251
252 --no-wildcards-match-slash
253 wildcards do not match slashes (/) with --exclude
254
255 --null --files-from reads null-terminated names, disable --directory
256
257 --numeric-owner
258 always use numbers for user/group names
259
260 -o, --old-archive, --portability
261 like --format=v7; -o exhibits this behavior when creating an ar‐
262 chive (deprecated behavior)
263
264 -o, --no-same-owner
265 do not attempt to restore ownership when extracting; -o exhibits
266 this behavior when extracting an archive
267
268 -O, --to-stdout
269 extract files to standard output
270
271 --occurrence NUM
272 process only NUM occurrences of each named file; used with
273 --delete, --diff, --extract, or --list
274
275 --overwrite
276 overwrite existing files and directory metadata when extracting
277
278 --overwrite-dir
279 overwrite directory metadata when extracting
280
281 --owner USER
282 change owner of extraced files to USER
283
284 -p, --same-permissions, --preserve-permissions
285 extract all protection information
286
287 -P, --absolute-names
288 don't strip leading `/'s from file names
289
290 --pax-option KEYWORD-LIST
291 used only with POSIX.1-2001 archives to modify the way tar han‐
292 dles extended header keywords
293
294 --posix
295 like --format=posix
296
297 --preserve
298 like --preserve-permissions --same-order
299
300 --acls this option causes tar to store each file's ACLs in the archive.
301
302 --selinux
303 this option causes tar to store each file's SELinux security
304 context information in the archive.
305
306 --xattrs
307 this option causes tar to store each file's extended attributes
308 in the archive. This option also enables --acls and--selinux if
309 they haven't been set already, due to the fact that the data for
310 those are stored in special xattrs.
311
312 --no-acls
313 This option causes tar not to store each file's ACLs in the ar‐
314 chive and not to extract any ACL information in an archive.
315
316 --no-selinux
317 this option causes tar not to store each file's SELinux security
318 context information in the archive and not to extract any
319 SELinux information in an archive.
320
321 --no-xattrs
322 this option causes tar not to store each file's extended
323 attributes in the archive and not to extract any extended
324 attributes in an archive. This option also enables --no-acls and
325 --no-selinux if they haven't been set already.
326
327 -R, --record-number
328 show record number within archive with each message
329
330 --record-size SIZE
331 use SIZE bytes per record when accessing archives
332
333 --recursion
334 recurse into directories
335
336 --recursive-unlink
337 remove existing directories before extracting directories of the
338 same name
339
340 --remove-files
341 remove files after adding them to the archive
342
343 --rmt-command CMD
344 use CMD instead of the default /usr/sbin/rmt
345
346 --rsh-command CMD
347 use remote CMD instead of rsh(1)
348
349 -s, --same-order, --preserve-order
350 list of names to extract is sorted to match archive
351
352 -S, --sparse
353 handle sparse files efficiently
354
355 --same-owner
356 create extracted files with the same ownership
357
358 --show-defaults
359 display the default options used by tar
360
361 --show-omitted-dirs
362 print directories tar skips while operating on an archive
363
364 --strip-components NUMBER, --strip-path NUMBER
365 strip NUMBER of leading components from file names before
366 extraction
367
368 (1) tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-compo‐
369 nents
370
371 --suffix SUFFIX
372 use SUFFIX instead of default '~' when backing up files
373
374 -T, --files-from F
375 get names to extract or create from file F
376
377 --totals
378 print total bytes written with --create
379
380 -U, --unlink-first
381 remove existing files before extracting files of the same name
382
383 --use-compress-program PROG
384 access the archive through PROG which is generally a compression
385 program
386
387 --utc display file modification dates in UTC
388
389 -v, --verbose
390 verbosely list files processed
391
392 -V, --label NAME
393 create archive with volume name NAME
394
395 --version
396 print tar program version number
397
398 --volno-file F
399 keep track of which volume of a multi-volume archive its working
400 in FILE; used with --multi-volume
401
402 -w, --interactive, --confirmation
403 ask for confirmation for every action
404
405 -W, --verify
406 attempt to verify the archive after writing it
407
408 --wildcards
409 use wildcards with --exclude
410
411 --wildcards-match-slash
412 wildcards match slashes (/) with --exclude
413
414 --exclude PATTERN
415 exclude files based upon PATTERN
416
417 -X, --exclude-from FILE
418 exclude files listed in FILE
419
420 -Z, --compress, --uncompress
421 filter the archive through compress
422
423 -z, --gzip, --gunzip, --ungzip
424 filter the archive through gzip
425
426 --use-compress-program PROG
427 filter the archive through PROG (which must accept -d)
428
429 -[0-7][lmh]
430 specify drive and density
431
433 The GNU folks, in general, abhor man pages, and create info documents
434 instead. The maintainer of tar falls into this category. Thus this
435 man page may not be complete, nor current, and was included in the Red
436 Hat CVS tree because man is a great tool :). This man page was first
437 taken from Debian Linux and has since been loving updated here.
438
440 Please report bugs via https://bugzilla.redhat.com
441
443 The full documentation for tar is maintained as a Texinfo manual. If
444 the info and tar programs are properly installed at your site, the com‐
445 mand
446
447 info tar
448
449 should give you access to the complete manual.
450
452 Debian Linux http://www.debian.org/
453 Mike Frysinger <vapier@gentoo.org>
454
455
456
457GNU Oct 2004 TAR(1)