(tar)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.


automatically generated by info2www version 1.2