Next: Ignore Failed Read, Up: create options
As described above, a tar archive keeps, for each member it contains, its metadata, such as modification time, mode and ownership of the file. GNU tar allows to replace these data with other values when adding files to the archive. The options described in this section affect creation of archives of any type. For POSIX archives, see also PAX keywords, for additional ways of controlling metadata, stored in the archive.
$ tar -c -f archive.tar --mode='a+rw' .
The following example will set the modification date to 00:00:00 UTC, January 1, 1970:
$ tar -c -f archive.tar --mtime='1970-01-01' .
When used with --verbose (see verbose tutorial) GNU tar will try to convert the specified date back to its textual representation and compare it with the one given with --mtime options. If the two dates differ, tar will print a warning saying what date it will use. This is to help user ensure he is using the right date.
For example:
$ tar -c -f archive.tar -v --mtime=yesterday . tar: Option --mtime: Treating date `yesterday' as 2006-06-20 13:06:29.152478 ...
There is no value indicating a missing number, and ‘0’ usually means
root
. Some people like to force ‘0’ as the value to offer in
their distributions for the owner of files, because the root
user is
anonymous anyway, so that might as well be the owner of anonymous
archives. For example:
$ tar -c -f archive.tar --owner=0 .
# Or:
$ tar -c -f archive.tar --owner=root .