tar
Topic: Archives
Program: tar
Packs files into an archive and back.
Package: archive
Usage
tar [OPTION]... [FILE]...
Description
Pack files and directories into one archive and get them back. One of c, x, t or r says what to do. The first word may leave out the dash, as in tar cvf a.tar notes.txt.
Options in the simulator
-
-c, --create make a fresh archive -
-x, --extract unpack files from an archive -
-t, --list list what an archive holds -
-r, --append add more files behind what an archive holds -
-f, --file=ARCHIVE the archive file; - means standard input or output -
-v, --verbose name each file; with t the long form -
-z, --gzip pack or unpack the archive with gzip -
-j, --bzip2 use bzip2 (not installed here) -
-J, --xz use xz (not installed here) -
-C, --directory=DIR change to DIR first, for the names after it -
-O, --to-stdout unpack to standard output instead of files -
-k, --keep-old-files do not replace existing files -
--exclude=PATTERN leave out names matching PATTERN -
--strip-components=N drop the first N parts of each name when unpacking -
-?, --help show this help and exit
142 more options of the real program, not in the simulator yet
-
-A, --catenate, --concatenatenot in the simulator yetExplanation to come
-
--deletenot in the simulator yetExplanation to come
-
-d, --diff, --comparenot in the simulator yetExplanation to come
-
--test-labelnot in the simulator yetExplanation to come
-
-u, --updatenot in the simulator yetExplanation to come
-
--check-devicenot in the simulator yetExplanation to come
-
-g, --listed-incrementalneeds a value not in the simulator yetExplanation to come
-
-G, --incrementalnot in the simulator yetExplanation to come
-
--hole-detectionneeds a value not in the simulator yetExplanation to come
-
--ignore-failed-readnot in the simulator yetExplanation to come
-
--levelneeds a value not in the simulator yetExplanation to come
-
--no-check-devicenot in the simulator yetExplanation to come
-
--no-seeknot in the simulator yetExplanation to come
-
-n, --seeknot in the simulator yetExplanation to come
-
--occurrencevalue optional not in the simulator yetExplanation to come
-
--sparse-versionneeds a value not in the simulator yetExplanation to come
-
-S, --sparsenot in the simulator yetExplanation to come
-
--add-fileneeds a value not in the simulator yetExplanation to come
-
--exclude-backupsnot in the simulator yetExplanation to come
-
--exclude-cachesnot in the simulator yetExplanation to come
-
--exclude-caches-allnot in the simulator yetExplanation to come
-
--exclude-caches-undernot in the simulator yetExplanation to come
-
--exclude-ignoreneeds a value not in the simulator yetExplanation to come
-
--exclude-ignore-recursiveneeds a value not in the simulator yetExplanation to come
-
--exclude-tagneeds a value not in the simulator yetExplanation to come
-
--exclude-tag-allneeds a value not in the simulator yetExplanation to come
-
--exclude-tag-underneeds a value not in the simulator yetExplanation to come
-
--exclude-vcsnot in the simulator yetExplanation to come
-
--exclude-vcs-ignoresnot in the simulator yetExplanation to come
-
--no-nullnot in the simulator yetExplanation to come
-
--no-recursionnot in the simulator yetExplanation to come
-
--no-unquotenot in the simulator yetExplanation to come
-
--no-verbatim-files-fromnot in the simulator yetExplanation to come
-
--nullnot in the simulator yetExplanation to come
-
--recursionnot in the simulator yetExplanation to come
-
-T, --files-fromneeds a value not in the simulator yetExplanation to come
-
--unquotenot in the simulator yetExplanation to come
-
--verbatim-files-fromnot in the simulator yetExplanation to come
-
-X, --exclude-fromneeds a value not in the simulator yetExplanation to come
-
--anchorednot in the simulator yetExplanation to come
-
--ignore-casenot in the simulator yetExplanation to come
-
--no-anchorednot in the simulator yetExplanation to come
-
--no-ignore-casenot in the simulator yetExplanation to come
-
--no-wildcardsnot in the simulator yetExplanation to come
-
--no-wildcards-match-slashnot in the simulator yetExplanation to come
-
--wildcardsnot in the simulator yetExplanation to come
-
--wildcards-match-slashnot in the simulator yetExplanation to come
-
--keep-directory-symlinknot in the simulator yetExplanation to come
-
--keep-newer-filesnot in the simulator yetExplanation to come
-
--no-overwrite-dirnot in the simulator yetExplanation to come
-
--one-top-levelvalue optional not in the simulator yetExplanation to come
-
--overwritenot in the simulator yetExplanation to come
-
--overwrite-dirnot in the simulator yetExplanation to come
-
--recursive-unlinknot in the simulator yetExplanation to come
-
--remove-filesnot in the simulator yetExplanation to come
-
--skip-old-filesnot in the simulator yetExplanation to come
-
-U, --unlink-firstnot in the simulator yetExplanation to come
-
-W, --verifynot in the simulator yetExplanation to come
-
--ignore-command-errornot in the simulator yetExplanation to come
-
--no-ignore-command-errornot in the simulator yetExplanation to come
-
--to-commandneeds a value not in the simulator yetExplanation to come
-
--atime-preservevalue optional not in the simulator yetExplanation to come
-
--clamp-mtimenot in the simulator yetExplanation to come
-
--delay-directory-restorenot in the simulator yetExplanation to come
-
--groupneeds a value not in the simulator yetExplanation to come
-
--group-mapneeds a value not in the simulator yetExplanation to come
-
--modeneeds a value not in the simulator yetExplanation to come
-
--mtimeneeds a value not in the simulator yetExplanation to come
-
-m, --touchnot in the simulator yetExplanation to come
-
--no-delay-directory-restorenot in the simulator yetExplanation to come
-
--no-same-ownernot in the simulator yetExplanation to come
-
--no-same-permissionsnot in the simulator yetExplanation to come
-
--numeric-ownernot in the simulator yetExplanation to come
-
--ownerneeds a value not in the simulator yetExplanation to come
-
--owner-mapneeds a value not in the simulator yetExplanation to come
-
-p, --preserve-permissions, --same-permissionsnot in the simulator yetExplanation to come
-
--same-ownernot in the simulator yetExplanation to come
-
--sortneeds a value not in the simulator yetExplanation to come
-
-s, --preserve-order, --same-ordernot in the simulator yetExplanation to come
-
--aclsnot in the simulator yetExplanation to come
-
--no-aclsnot in the simulator yetExplanation to come
-
--no-selinuxnot in the simulator yetExplanation to come
-
--no-xattrsnot in the simulator yetExplanation to come
-
--selinuxnot in the simulator yetExplanation to come
-
--xattrsnot in the simulator yetExplanation to come
-
--xattrs-excludeneeds a value not in the simulator yetExplanation to come
-
--xattrs-includeneeds a value not in the simulator yetExplanation to come
-
--force-localnot in the simulator yetExplanation to come
-
-F, --info-script, --new-volume-scriptneeds a value not in the simulator yetExplanation to come
-
-L, --tape-lengthneeds a value not in the simulator yetExplanation to come
-
-M, --multi-volumenot in the simulator yetExplanation to come
-
--rmt-commandneeds a value not in the simulator yetExplanation to come
-
--rsh-commandneeds a value not in the simulator yetExplanation to come
-
--volno-fileneeds a value not in the simulator yetExplanation to come
-
-b, --blocking-factorneeds a value not in the simulator yetExplanation to come
-
-B, --read-full-recordsnot in the simulator yetExplanation to come
-
-i, --ignore-zerosnot in the simulator yetExplanation to come
-
--record-sizeneeds a value not in the simulator yetExplanation to come
-
-H, --formatneeds a value not in the simulator yetExplanation to come
-
--old-archive, --portabilitynot in the simulator yetExplanation to come
-
--pax-optionneeds a value not in the simulator yetExplanation to come
-
--posixnot in the simulator yetExplanation to come
-
-V, --labelneeds a value not in the simulator yetExplanation to come
-
-a, --auto-compressnot in the simulator yetExplanation to come
-
-I, --use-compress-programneeds a value not in the simulator yetExplanation to come
-
--lzipnot in the simulator yetExplanation to come
-
--lzmanot in the simulator yetExplanation to come
-
--lzopnot in the simulator yetExplanation to come
-
--no-auto-compressnot in the simulator yetExplanation to come
-
--zstdnot in the simulator yetExplanation to come
-
-Z, --compress, --uncompressnot in the simulator yetExplanation to come
-
--backupvalue optional not in the simulator yetExplanation to come
-
--hard-dereferencenot in the simulator yetExplanation to come
-
-h, --dereferencenot in the simulator yetExplanation to come
-
-K, --starting-fileneeds a value not in the simulator yetExplanation to come
-
--newer-mtimeneeds a value not in the simulator yetExplanation to come
-
-N, --newer, --after-dateneeds a value not in the simulator yetExplanation to come
-
--one-file-systemnot in the simulator yetExplanation to come
-
-P, --absolute-namesnot in the simulator yetExplanation to come
-
--suffixneeds a value not in the simulator yetExplanation to come
-
--transform, --xformneeds a value not in the simulator yetExplanation to come
-
--checkpointvalue optional not in the simulator yetExplanation to come
-
--checkpoint-actionneeds a value not in the simulator yetExplanation to come
-
--full-timenot in the simulator yetExplanation to come
-
--index-fileneeds a value not in the simulator yetExplanation to come
-
-l, --check-linksnot in the simulator yetExplanation to come
-
--no-quote-charsneeds a value not in the simulator yetExplanation to come
-
--quote-charsneeds a value not in the simulator yetExplanation to come
-
--quoting-styleneeds a value not in the simulator yetExplanation to come
-
-R, --block-numbernot in the simulator yetExplanation to come
-
--show-defaultsnot in the simulator yetExplanation to come
-
--show-omitted-dirsnot in the simulator yetExplanation to come
-
--show-snapshot-field-rangesnot in the simulator yetExplanation to come
-
--show-transformed-names, --show-stored-namesnot in the simulator yetExplanation to come
-
--totalsvalue optional not in the simulator yetExplanation to come
-
--utcnot in the simulator yetExplanation to come
-
-w, --interactive, --confirmationnot in the simulator yetExplanation to come
-
--warningneeds a value not in the simulator yetExplanation to come
-
-onot in the simulator yetExplanation to come
-
--restrictnot in the simulator yetExplanation to come
-
--usagenot in the simulator yetExplanation to come
-
--versionnot in the simulator yetExplanation to come
Examples
$ tar -czf shop.tar.gz projects/shop
$ ls -lh shop.tar.gz
-rw-r--r-- 1 lerner lerner 423 Oct 17 09:42 shop.tar.gz Where you learn it
Lessons
- Packing and mirroring Linux Basics, Module 8: Disks and storage