File: tar.info, Node: Comparing Archives Members with Files, Next: Matching Format Parameters, Prev: Extracting Archive Members, Up: Basic tar Operations
Comparing Archives Members with Files
=====================================
*(This message will disappear, once this node revised.)*
The `--compare' (`-d') or `--diff' option compares the contents of
the specified archive members against the files with the same names,
and reports its findings. If no members are named on the command line,
or through `--files-from=FILE-OF-NAMES' (`-T FILE-OF-NAMES'), then the
entire archive is so compared.
File: tar.info, Node: Matching Format Parameters, Prev: Comparing Archives Members with Files, Up: Basic tar Operations
Matching the Format Parameters
==============================
*(This message will disappear, once this node revised.)*
Some format parameters must be taken into consideration when
modifying an archive:
Compressed archives cannot be modified.
You have to specify the block size of the archive when modifying an
archive with a non-default block size.
Multi-volume archives can be modified like any other archive. To add
files to a multi-volume archive, you need to only mount the last volume
of the archive media (and new volumes, if needed). For all other
operations, you need to use the entire archive.
If a multi-volume archive was labeled using `--label=ARCHIVE-LABEL'
(`-V ARCHIVE-LABEL') (
FIXME: pxref Archive Label
) when it was created, `tar' will not automatically label volumes
which are added later. To label subsequent volumes, specify
`--label=ARCHIVE-LABEL' (`-V ARCHIVE-LABEL') again in conjunction with
the `--append' (`-r'), `--update' (`-u') or `--concatenate' (`-A')
operation.
FIXME: example
FIXME: xref somewhere, for more information about format parameters.
File: tar.info, Node: Specifying Names to tar, Next: Being Careful, Prev: Basic tar Operations, Up: Top
Specifying Names to `tar'
*************************
*(This message will disappear, once this node revised.)*
* Menu:
* Changing the Archive Name::
* Characteristics::
* Selection Options::
File: tar.info, Node: Changing the Archive Name, Next: Characteristics, Prev: Specifying Names to tar, Up: Specifying Names to tar
Changing the Archive Name
=========================
*(This message will disappear, once this node revised.)*
By default, `tar' uses an archive file name compiled in when `tar'
was built. Usually this refers to some physical tape drive on the
machine. Often, the installer of `tar' didn't set the default to
anything meaningful at all.
As a result, most uses of `tar' need to tell `tar' where to find (or
create) the archive. The `--file=ARCHIVE-NAME' (`-f ARCHIVE-NAME')
option selects another file to use as the archive.
If the archive file name includes a colon (`:'), then it is assumed
to be a file on another machine. If the archive file is
`USER@HOST:FILE', then FILE is used on the host HOST. The remote host
is accessed using the `rsh' program, with a username of USER. If the
username is omitted (along with the `@' sign), then your user name will
be used. (This is the normal `rsh' behavior.) It is necessary for the
remote machine, in addition to permitting your `rsh' access, to have
the `/usr/ucb/rmt' program installed. If you need to use a file whose
name includes a colon, then the remote tape drive behavior can be
inhibited by using the `--force-local' option.
If the file name you give to `--file=ARCHIVE-NAME' (`-f
ARCHIVE-NAME') is a single dash (`-'), then `tar' will read the archive
from (or write it to) standard input (or standard output).
The Name of an Archive
An archive can be saved as a file in the file system, sent through a
pipe or over a network, or written to an I/O device such as a tape or
disk drive. To specify the name of the archive, use the
`--file=ARCHIVE-NAME' (`-f ARCHIVE-NAME') option.
An archive name can be the name of an ordinary file or the name of an
I/O device. `tar' always needs an archive name--if you do not specify
an archive name, the archive name comes from the environment variable
`TAPE' or, if that variable is not specified, a default archive name,
which is usually the name of tape unit zero (ie. /dev/tu00).
If you use `-' as an ARCHIVE-NAME, `tar' reads the archive from
standard input (when listing or extracting files), or writes it to
standard output (when creating an archive). If you use `-' as an
ARCHIVE-NAME when modifying an archive, `tar' reads the original
archive from its standard input and writes the entire new archive to
its standard output.
FIXME: does standard input and output redirection work with all
FIXME: operations?
FIXME: need example for standard input and output (screen and keyboard?)
To specify an archive file on a device attached to a remote machine,
use the following:
--file=HOSTNAME:/DEV/FILE NAME
`tar' will complete the remote connection, if possible, and prompt you
for a username and password. If you use `--file=@HOSTNAME:/DEV/FILE
NAME', `tar' will complete the remote connection, if possible, using
your username as the username on the remote machine.
FIXME: is this clear?
`--file=ARCHIVE-NAME'
`-f ARCHIVE-NAME'
Names the archive to create or operate on. Use in conjunction with
any operation.
Selecting Archive Members
"File Name arguments" specify which files in the file system `tar'
operates on, when creating or adding to an archive, or which archive
members `tar' operates on, when reading or deleting from an archive. (
FIXME: pxref Reading and Writing
.)
To specify file names, you can include them as the last arguments on
the command line, as follows:
tar OPERATION [OPTION1 OPTION2 ..] [FILE NAME-1 FILE NAME-2 ...]
If you specify a directory name as a file name argument, all the
files in that directory are operated on by `tar'.
If you do not specify files when `tar' is invoked, `tar' operates on
all the non-directory files in the working directory (if the operation
is `--create' (`-c')), all the archive members in the archive (if a
read operation is specified), or does nothing (if any other operation
is specified).
When specifying the names of files or members to `tar', it by
default takes the names of the files from the command line. There are
other ways, however, to specify file or member names, or to modify the
manner in which `tar' selects the files or members upon which to
operate. In general, these methods work both for specifying the names
of files and archive members.
File: tar.info, Node: Characteristics, Next: Selection Options, Prev: Changing the Archive Name, Up: Specifying Names to tar
Selecting Files by Characteristic
=================================
To avoid crossing file system boundaries when archiving parts of a
directory tree, use `--one-file-system' (`-l'). This option only
affects files that are archived because they are in a directory that is
being archived; files explicitly named on the command line are archived
regardless of where they reside.
This option is useful for making full or incremental archival backups
of a file system.
If this option is used in conjunction with `--verbose' (`-v'), files
that are excluded are mentioned by name on the standard error.
`--one-file-system'
`-l'
Prevents `tar' from crossing file system boundaries when
archiving. Use in conjunction with any write operation.
To avoid operating on files whose names match a particular pattern,
use the `--exclude=PATTERN' or `--exclude-from=FILE-OF-PATTERNS' (`-X
FILE-OF-PATTERNS') options.
When you specify the `--exclude=PATTERN' option, `tar' ignores files
which match the PATTERN, which can be a single file name or a more
complex expression. Thus, if you invoke `tar' with `tar --create
--exclude=*.o', no files whose names end in `.o' are included in the
archive.
FIXME: what other things can you use besides "*"?
`--exclude-from=FILE-OF-PATTERNS' (`-X FILE-OF-PATTERNS') acts like
`--exclude=PATTERN', but specifies a file FILE containing a list of
patterns. `tar' ignores files with names that fit any of these
patterns.
You can use either option more than once in a single command.
`--exclude=PATTERN'
Causes `tar' to ignore files that match the PATTERN.
`--exclude-from=FILE'
Causes `tar' to ignore files that match the patterns listed in
FILE.
FIXME: --exclude-from used to be "--exclude", --exclude didn't used to
FIXME: exist.
To operate only on files with modification or status-change times
after a particular date, use `--after-date=DATE' (`-N DATE'). You can
use this option with `--create' (`-c') or `--append' (`-r') to insure
only new files are archived, or with `--extract' (`-x') to insure only
recent files are resurrected.
FIXME: or --newer DATE
`--newer-mtime=DATE' acts like `--after-date=DATE' (`-N DATE') but
tests just the modification times of the files, ignoring status-change
times.
FIXME: need example of --newer-mtime with quoted argument
Remember that the entire date argument should be quoted if it
contains any spaces.
*Please Note:* `--after-date=DATE' (`-N DATE') and
`--newer-mtime=DATE' should not be used for incremental backups. Some
files (such as those in renamed directories) are not selected up
properly by these options.
FIXME: xref to incremental backup chapter when node name is decided.
`--after-date=DATE'
`--newer=DATE'
`-N DATE'
Acts on files only if their modification or inode-changed times are
later than DATE. Use in conjunction with any operation.
`--newer-mtime=DATE'
Acts like `--after-date=DATE' (`-N DATE'), but only looks at
modification times.
FIXME: following is the getdate date format --- needs to be re-written,
FIXME: made a sub-node:
Time/Date Formats Accepted by getdate (omitting obscure
constructions)
The input consists of one or more of: time zone day date year in any
order.
Those in turn consist of (`|' and `/' mean `or', `[]' means