Copy files to or restore files from an archive medium. If any files are directories, tar acts on the entire subtree. tar was originally used to create tape archives and still has options related to that use. However, here we document the options commonly used today. Options need not be preceded by - (though they may be). The exception to this rule is when you are using a long-style option (such as --touch). In that case, the exact syntax is:
tar --touch -xvf tarfile.tar
You must use exactly one of these, and it must come before any other options:
- -A, --catenate, --concatenate
Concatenate a second tar file to the end of the first.
- -c, --create
Create a new archive.
- -d, --diff, --compare
Compare the files stored in tarfile with other-files. Report any differences: missing files, different sizes, different file attributes (such as permissions or modification time).
Delete from the archive. This option cannot be used with magnetic tape.
- -r, --append
Append other-files to the end of an existing archive.
- -t, --list
Print the names of other-files if they are stored in the archive (if other-files are not specified, print names of all archived files).
- -u, --update
Add files if not in the archive or if modified.
- -x, --extract, --get
Extract other-files from an archive (if other-files are not specified, extract all files).
Exclude patterns must match the start ...