Tape archiving utility tar mode[options] pathname...
Modes #
Mode | Description |
---|---|
c | Create from list of files and/or dirs |
x | Extract an archive |
r | Append specified pathnames to end of archive |
t | List contents of an archive |
Mode must come before anything else
Tar extracts using relative pathnames. Careful when remounting or
archiving. Can use --wildcards
flag to use shell expansion. Can be
used in conjunction with find
to produce archives like so:
[me@linuxbox ~]$ find playground -name 'file-A' -exec tar rf
playground.tar '{}' '+'
# or
[me@linuxbox ~]$ find playground -name 'file-A' | tar cf - --files-
from=- | gzip > playground.tgz
# simplified version of above, modern gnu tar supports gzip and bzip2
[me@linuxbox ~]$ find playground -name 'file-A' | tar czf
playground.tgz -T -~