home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / tar-1.11.8-bin.lha / info / tar.info-4 (.txt) < prev    next >
GNU Info File  |  1996-10-12  |  50KB  |  891 lines

  1. This is Info file tar.info, produced by Makeinfo-1.64 from the input
  2. file /ade-src/fsf/tar/doc/tar.texinfo.
  3. START-INFO-DIR-ENTRY
  4. * tar: (tar).            Making tape (or disk) archives.
  5. END-INFO-DIR-ENTRY
  6.    This file documents GNU `tar', a utility used to store, backup, and
  7. transport files.
  8.    Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided that
  14. the entire resulting derived work is distributed under the terms of a
  15. permission notice identical to this one.
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that this permission notice may be stated in a
  19. translation approved by the Foundation.
  20. File: tar.info,  Node: Archive Reading Options,  Next: File Writing Options,  Prev: Extracting Archive Members,  Up: Extracting Archive Members
  21. Options to Help Read Archives
  22. -----------------------------
  23.      *(This message will disappear, once this node revised.)*
  24. FIXME: each option wants its own node.  summary after menu
  25.    Normally, `tar' will request data in full block increments from an
  26. archive storage device.  If the device cannot return a full block,
  27. `tar' will report an error.  However, some devices do not always return
  28. full blocks, or do not require the last block of an archive to be
  29. padded out to the next block boundary.  To keep reading until you
  30. obtain a full block, or to accept an incomplete block if it contains an
  31. end-of-archive marker, specify the `--read-full-blocks' (`-B') option
  32. in conjunction with the `--extract' (`-x') or `--list' (`-t')
  33. operations.
  34. FIXME: xref Listing Contents
  35.    The `--read-full-blocks' (`-B') option is turned on by default when
  36. `tar' reads an archive from standard input, or from a remote machine.
  37. This is because on BSD Unix systems, attempting to read a pipe returns
  38. however much happens to be in the pipe, even if it is less than was
  39. requested.  If this option were not enabled, `tar' would fail as soon
  40. as it read an incomplete block from the pipe.
  41.    If you're not sure of the blocking factor of an archive, you can
  42. read the archive by specifying `--read-full-blocks' (`-B') and
  43. `--block-size=512-SIZE' (`-b 512-SIZE'), using a blocking factor larger
  44. than what the archive uses.  This lets you avoid having to determine
  45. the blocking factor of an archive.
  46. FIXME: xref Blocking Factor
  47. `--read-full-blocks'
  48.      Use in conjunction with `--extract' (`-x') to read an archive which
  49.      contains incomplete blocks, or one which has a blocking factor less
  50.      than the one specified.
  51.    Normally `tar' stops reading when it encounters a block of zeros
  52. between file entries (which usually indicates the end of the archive).
  53. `--ignore-zeros' (`-i') allows `tar' to completely read an archive
  54. which contains a block of zeros before the end (i.e. a damaged archive,
  55. or one which was created by `cat'-ing several archives together).
  56.    The `--ignore-zeros' (`-i') option is turned off by default because
  57. many versions of `tar' write garbage after the end-of-archive entry,
  58. since that part of the media is never supposed to be read.  GNU `tar'
  59. does not write after the end of an archive, but seeks to maintain
  60. compatablity among archiving utilities.
  61. `--ignore-zeros'
  62.      To ignore blocks of zeros (ie. end-of-archive entries) which may be
  63.      encountered while reading an archive.  Use in conjunction with
  64.      `--extract' (`-x') or `--list' (`-t').
  65.    If you are using a machine with a small amount of memory, and you
  66. need to process large list of file names, you can reduce the amount of
  67. space `tar' needs to process the list.  To do so, specify the
  68. `--same-order' (`-s') option and provide an ordered list of file names.
  69. This option tells `tar' that the NAME arguments provided on the command
  70. line, or read from a file using the `--files-from=FILE-OF-NAMES' (`-T
  71. FILE-OF-NAMES') option, are listed in the same order as the files in
  72. the archive.
  73.    You can create a file containing an ordered list of files in the
  74. archive by storing the output produced by `tar --list
  75. --file=ARCHIVE-NAME'.
  76. FIXME: xref Listing Contents
  77.    , for information on the `--list' (`-t') operation.
  78.    This option is probably never needed on modern computer systems.
  79. `--same-order'
  80. `--preserve-order'
  81.      To process large lists of file names on machines with small
  82.      amounts of memory.  Use in conjunction with `--compare' (`-d'),
  83.      `--list' (`-t') or `--extract' (`-x').
  84. FIXME: we don't need/want --preserve to exist any more
  85. File: tar.info,  Node: File Writing Options,  Next: Scarce Disk Space,  Prev: Archive Reading Options,  Up: Extracting Archive Members
  86. Changing How `tar' Writes Files
  87. -------------------------------
  88. FIXME: find a better title
  89.      *(This message will disappear, once this node revised.)*
  90.    Normally, `tar' writes extracted files into the file system without
  91. regard to the files already on the system--files with the same name as
  92. archive members are overwritten.  To prevent `tar' from extracting an
  93. archive member from an archive, if doing so will overwrite a file in
  94. the file system, use `--keep-old-files' (`-k') in conjunction with the
  95. `--extract' (`-x') operation.  When this option is specified, `tar'
  96. reports an error stating the name of the files in conflict, instead of
  97. writing the file from the archive.
  98. `--keep-old files'
  99.      Prevents `tar' from overwriting files in the file system during
  100.      extraction.
  101.    Normally, `tar' sets the modification times of extracted files to
  102. the modification times recorded for the files in the archive, but
  103. limits the permissions of extracted files by the current `umask'
  104. setting.
  105.    To set the modification times of extracted files to the time when
  106. the files were extracted, use the `--modification-time' (`-m') option in
  107. conjunction with `--extract' (`-x').
  108. `--modification-time'
  109.      Sets the modification time of extracted archive members to the time
  110.      they were extracted, not the time recorded for them in the archive.
  111.      Use in conjunction with `--extract' (`-x').
  112.    To set the modes (access permissions) of extracted files to those
  113. recorded for those files in the archive, use the {No Value For
  114. "same-persmissions"} option in conjunction with the `--extract' (`-x')
  115. operation.
  116. FIXME: mib --- should be aliased to ignore-umask.
  117. `--preserve-permission'
  118. `--same-permission'
  119. `--ignore-umask'
  120.      Set modes of extracted archive members to those recorded in the
  121.      archive, instead of current umask settings.  Use in conjunction
  122.      with `--extract' (`-x').
  123. FIXME: following paragraph needs to be rewritten: why doesnt' this cat
  124. FIXME: files together, why is this useful.  is it really useful with
  125. FIXME: more than one file?
  126.    To write the files extracted to the standard output, instead of
  127. creating the files on the file system, use `--to-stdout' (`-O') in
  128. conjunction with `--extract' (`-x').  This option is useful if you are
  129. extracting files to send them through a pipe, and do not need to
  130. preserve them in the file system.
  131. `--to-stdout'
  132.      Writes files to the standard output.  Used in conjunction with
  133.      `--extract' (`-x').
  134. FIXME: why would you want to do such a thing, how are files separated on
  135. FIXME: the standard output? is this useful with more that one file?  are
  136. FIXME: pipes the real reason?
  137. File: tar.info,  Node: Scarce Disk Space,  Prev: File Writing Options,  Up: Extracting Archive Members
  138. Recovering From Scarce Disk Space
  139. ---------------------------------
  140.      *(This message will disappear, once this node revised.)*
  141.    If a previous attempt to extract files failed due to lack of disk
  142. space, you can use `--starting-file=NAME' (`-K NAME') to start
  143. extracting only after file NAME when extracting files from the archive.
  144. This assumes, of course, that there is now free space, or that you are
  145. now extracting into a different file system.
  146. `--starting-file=FILE NAME'
  147. `-K FILE NAME'
  148.      Starts an operation in the middle of an archive.  Use in
  149.      conjunction with `--extract' (`-x') or `--list' (`-t').
  150.    If you notice you are running out of disk space during an extraction
  151. operation, you can also suspend `tar', remove unnecessary files from
  152. the file system, and then restart the same `tar' operation.  In this
  153. case, `--starting-file=NAME' (`-K NAME') is not necessary.
  154. FIXME: xref --incremental,  xref --interactive,  xref --exclude
  155. File: tar.info,  Node: Comparing Archives Members with Files,  Next: Matching Format Parameters,  Prev: Extracting Archive Members,  Up: Basic tar Operations
  156. Comparing Archives Members with Files
  157. =====================================
  158.      *(This message will disappear, once this node revised.)*
  159.    The `--compare' (`-d') or `--diff' option compares the contents of
  160. the specified archive members against the files with the same names,
  161. and reports its findings.  If no members are named on the command line,
  162. or through `--files-from=FILE-OF-NAMES' (`-T FILE-OF-NAMES'), then the
  163. entire archive is so compared.
  164. File: tar.info,  Node: Matching Format Parameters,  Prev: Comparing Archives Members with Files,  Up: Basic tar Operations
  165. Matching the Format Parameters
  166. ==============================
  167.      *(This message will disappear, once this node revised.)*
  168.    Some format parameters must be taken into consideration when
  169. modifying an archive:
  170.    Compressed archives cannot be modified.
  171.    You have to specify the block size of the archive when modifying an
  172. archive with a non-default block size.
  173.    Multi-volume archives can be modified like any other archive.  To add
  174. files to a multi-volume archive, you need to only mount the last volume
  175. of the archive media (and new volumes, if needed).  For all other
  176. operations, you need to use the entire archive.
  177.    If a multi-volume archive was labeled using `--label=ARCHIVE-LABEL'
  178. (`-V ARCHIVE-LABEL') (
  179. FIXME: pxref Archive Label
  180.    ) when it was created, `tar' will not automatically label volumes
  181. which are added later.  To label subsequent volumes, specify
  182. `--label=ARCHIVE-LABEL' (`-V ARCHIVE-LABEL') again in conjunction with
  183. the `--append' (`-r'), `--update' (`-u') or `--concatenate' (`-A')
  184. operation.
  185. FIXME: example
  186. FIXME: xref somewhere, for more information about format parameters.
  187. File: tar.info,  Node: Specifying Names to tar,  Next: Being Careful,  Prev: Basic tar Operations,  Up: Top
  188. Specifying Names to `tar'
  189. *************************
  190.      *(This message will disappear, once this node revised.)*
  191. * Menu:
  192. * Changing the Archive Name::
  193. * Characteristics::
  194. * Selection Options::
  195. File: tar.info,  Node: Changing the Archive Name,  Next: Characteristics,  Prev: Specifying Names to tar,  Up: Specifying Names to tar
  196. Changing the Archive Name
  197. =========================
  198.      *(This message will disappear, once this node revised.)*
  199.    By default, `tar' uses an archive file name compiled in when `tar'
  200. was built.  Usually this refers to some physical tape drive on the
  201. machine.  Often, the installer of `tar' didn't set the default to
  202. anything meaningful at all.
  203.    As a result, most uses of `tar' need to tell `tar' where to find (or
  204. create) the archive.  The `--file=ARCHIVE-NAME' (`-f ARCHIVE-NAME')
  205. option selects another file to use as the archive.
  206.    If the archive file name includes a colon (`:'), then it is assumed
  207. to be a file on another machine.  If the archive file is
  208. `USER@HOST:FILE', then FILE is used on the host HOST.  The remote host
  209. is accessed using the `rsh' program, with a username of USER.  If the
  210. username is omitted (along with the `@' sign), then your user name will
  211. be used.  (This is the normal `rsh' behavior.)  It is necessary for the
  212. remote machine, in addition to permitting your `rsh' access, to have
  213. the `/usr/ucb/rmt' program installed.  If you need to use a file whose
  214. name includes a colon, then the remote tape drive behavior can be
  215. inhibited by using the `--force-local' option.
  216.    If the file name you give to `--file=ARCHIVE-NAME' (`-f
  217. ARCHIVE-NAME') is a single dash (`-'), then `tar' will read the archive
  218. from (or write it to) standard input (or standard output).
  219.    The Name of an Archive
  220.    An archive can be saved as a file in the file system, sent through a
  221. pipe or over a network, or written to an I/O device such as a tape or
  222. disk drive.  To specify the name of the archive, use the
  223. `--file=ARCHIVE-NAME' (`-f ARCHIVE-NAME') option.
  224.    An archive name can be the name of an ordinary file or the name of an
  225. I/O device.  `tar' always needs an archive name--if you do not specify
  226. an archive name, the archive name comes from the environment variable
  227. `TAPE' or, if that variable is not specified, a default archive name,
  228. which is usually the name of tape unit zero (ie.  /dev/tu00).
  229.    If you use `-' as an ARCHIVE-NAME, `tar' reads the archive from
  230. standard input (when listing or extracting files), or writes it to
  231. standard output (when creating an archive).  If you use `-' as an
  232. ARCHIVE-NAME when modifying an archive, `tar' reads the original
  233. archive from its standard input and writes the entire new archive to
  234. its standard output.
  235. FIXME: does standard input and output redirection work with all
  236. FIXME: operations?
  237. FIXME: need example for standard input and output (screen and keyboard?)
  238.    To specify an archive file on a device attached to a remote machine,
  239. use the following:
  240.      --file=HOSTNAME:/DEV/FILE NAME
  241. `tar' will complete the remote connection, if possible, and prompt you
  242. for a username and password.  If you use `--file=@HOSTNAME:/DEV/FILE
  243. NAME', `tar' will complete the remote connection, if possible, using
  244. your username as the username on the remote machine.
  245. FIXME: is this clear?
  246. `--file=ARCHIVE-NAME'
  247. `-f ARCHIVE-NAME'
  248.      Names the archive to create or operate on.  Use in conjunction with
  249.      any operation.
  250.    Selecting Archive Members
  251.    "File Name arguments" specify which files in the file system `tar'
  252. operates on, when creating or adding to an archive, or which archive
  253. members `tar' operates on, when reading or deleting from an archive.  (
  254. FIXME: pxref Reading and Writing
  255.    .)
  256.    To specify file names, you can include them as the last arguments on
  257. the command line, as follows:
  258.      tar OPERATION [OPTION1 OPTION2 ..] [FILE NAME-1 FILE NAME-2 ...]
  259.    If you specify a directory name as a file name argument, all the
  260. files in that directory are operated on by `tar'.
  261.    If you do not specify files when `tar' is invoked, `tar' operates on
  262. all the non-directory files in the working directory (if the operation
  263. is `--create' (`-c')), all the archive members in the archive (if a
  264. read operation is specified), or does nothing (if any other operation
  265. is specified).
  266.    When specifying the names of files or members to `tar', it by
  267. default takes the names of the files from the command line.  There are
  268. other ways, however, to specify file or member names, or to modify the
  269. manner in which `tar' selects the files or members upon which to
  270. operate.  In general, these methods work both for specifying the names
  271. of files and archive members.
  272. File: tar.info,  Node: Characteristics,  Next: Selection Options,  Prev: Changing the Archive Name,  Up: Specifying Names to tar
  273. Selecting Files by Characteristic
  274. =================================
  275.    To avoid crossing file system boundaries when archiving parts of a
  276. directory tree, use `--one-file-system' (`-l').  This option only
  277. affects files that are archived because they are in a directory that is
  278. being archived; files explicitly named on the command line are archived
  279. regardless of where they reside.
  280.    This option is useful for making full or incremental archival backups
  281. of a file system.
  282.    If this option is used in conjunction with `--verbose' (`-v'), files
  283. that are excluded are mentioned by name on the standard error.
  284. `--one-file-system'
  285.      Prevents `tar' from crossing file system boundaries when
  286.      archiving.  Use in conjunction with any write operation.
  287.    To avoid operating on files whose names match a particular pattern,
  288. use the `--exclude=PATTERN' or `--exclude-from=FILE-OF-PATTERNS' (`-X
  289. FILE-OF-PATTERNS') options.
  290.    When you specify the `--exclude=PATTERN' option, `tar' ignores files
  291. which match the PATTERN, which can be a single file name or a more
  292. complex expression.  Thus, if you invoke `tar' with `tar --create
  293. --exclude=*.o', no files whose names end in `.o' are included in the
  294. archive.
  295. FIXME: what other things can you use besides "*"?
  296.    `--exclude-from=FILE-OF-PATTERNS' (`-X FILE-OF-PATTERNS') acts like
  297. `--exclude=PATTERN', but specifies a file FILE containing a list of
  298. patterns.  `tar' ignores files with names that fit any of these
  299. patterns.
  300.    You can use either option more than once in a single command.
  301. `--exclude=PATTERN'
  302.      Causes `tar' to ignore files that match the PATTERN.
  303. `--exclude-from=FILE'
  304.      Causes `tar' to ignore files that match the patterns listed in
  305.      FILE.
  306. FIXME: --exclude-from used to be "--exclude", --exclude didn't used to
  307. FIXME: exist.
  308.    To operate only on files with modification or status-change times
  309. after a particular date, use `--after-date=DATE' (`-N DATE').  You can
  310. use this option with `--create' (`-c') or `--append' (`-r') to insure
  311. only new files are archived, or with `--extract' (`-x') to insure only
  312. recent files are resurrected.
  313. FIXME: or --newer DATE
  314.    `--newer-mtime=DATE' acts like `--after-date=DATE' (`-N DATE') but
  315. tests just the modification times of the files, ignoring status-change
  316. times.
  317. FIXME: need example of --newer-mtime with quoted argument
  318.    Remember that the entire date argument should be quoted if it
  319. contains any spaces.
  320.    *Please Note:* `--after-date=DATE' (`-N DATE') and
  321. `--newer-mtime=DATE' should not be used for incremental backups.  Some
  322. files (such as those in renamed directories) are not selected up
  323. properly by these options.
  324. FIXME: xref to incremental backup chapter when node name is decided.
  325. `--after-date=DATE'
  326. `--newer=DATE'
  327. `-N DATE'
  328.      Acts on files only if their modification or inode-changed times are
  329.      later than DATE.  Use in conjunction with any operation.
  330. `--newer-mtime=DATE'
  331.      Acts like `--after-date=DATE' (`-N DATE'), but only looks at
  332.      modification times.
  333. FIXME: following is the getdate date format --- needs to be re-written,
  334. FIXME: made a sub-node:
  335.    Time/Date Formats Accepted by getdate (omitting obscure
  336. constructions)
  337.    The input consists of one or more of: time zone day date year in any
  338. order.
  339.    Those in turn consist of (`|' and `/' mean `or', `[]' means
  340. `optional'):
  341.    time: H am/pm | H:M [am/pm] | H:M:S [am/pm] zone: timezone-name |
  342. timezone-name dst day: day-name | day-name, | N day-name date: M/D |
  343. M/D/Y | month-name D | month-name D, Y | D month-name | D month-name Y
  344. year: Y
  345.    am can also be a.m., pm can also be p.m.  case and spaces around
  346. punctuation are not significant.
  347. FIXME: month and day names can be abbreviated.
  348. * Menu:
  349. * Reading Names from a File::
  350. * Excluding Some Files::
  351. * Operating Only on New Files::
  352. * Crossing Filesystem Boundaries::
  353. File: tar.info,  Node: Reading Names from a File,  Next: Excluding Some Files,  Prev: Characteristics,  Up: Characteristics
  354. Reading Names from a File
  355. -------------------------
  356.      *(This message will disappear, once this node revised.)*
  357.    Instead of giving the names of files or archive members on the
  358. command line, you can put the names into a file, and then use the
  359. `--files-from=FILE-OF-NAMES' (`-T FILE-OF-NAMES') option to `tar'.
  360. Give the name of the file which contains the list as the argument to
  361. `--files-from=FILE-OF-NAMES' (`-T FILE-OF-NAMES').  The file names
  362. should be separated by newlines in the list.  If you give a single dash
  363. as a file name for `--files-from=FILE-OF-NAMES' (`-T FILE-OF-NAMES'),
  364. that is, you specify `--files-from=-' (`-T -'), then the file names are
  365. read from standard input.
  366.    If you want to specify names that might contain newlines, use the
  367. `--null' option.  Then, the file names should be separated by NUL
  368. characters (ASCII 000) instead of newlines.  In addition, the `--null'
  369. option turns off the `--directory=DIRECTORY' (`-C DIRECTORY') option (
  370. FIXME: pxref Changing Directory
  371.    ).
  372.    Reading a List of File Names from a File
  373.      *(This message will disappear, once this node revised.)*
  374.    To read file names from a file on the file system, instead of from
  375. the command line, use the `--files-from=FILE-OF-NAMES' (`-T
  376. FILE-OF-NAMES') option.  If you specify `-' as FILE, the file names are
  377. read from standard input.  Note that using both `--files-from=-' (`-T
  378. -') and `--file=-' (`-f -') in the same command will not work unless
  379. the operation is `--create' (`-c').
  380. FIXME: xref Archive Name
  381.    , for an explanation of the `--file=ARCHIVE-NAME' (`-f
  382. ARCHIVE-NAME') option.
  383. `--files-from=FILE'
  384. `-T FILE'
  385.      Reads file name arguments from a file on the file system, instead
  386.      of from the command line.  Use in conjunction with any operation.
  387. File: tar.info,  Node: Excluding Some Files,  Next: Operating Only on New Files,  Prev: Reading Names from a File,  Up: Characteristics
  388. Excluding Some Files
  389. --------------------
  390.      *(This message will disappear, once this node revised.)*
  391.    The `--exclude=PATTERN' option will prevent any file or member which
  392. matches the regular expression PATTERN from being operated on.  For
  393. example, if you want to create an archive with all the contents of
  394. `/tmp' except the file `/tmp/foo', you can use the command `tar
  395. --create --file=arch.tar --exclude=foo'.
  396.    If there are many files you want to exclude, you can use the
  397. `--exclude-from=FILE-OF-PATTERNS' (`-X FILE-OF-PATTERNS') option.  This
  398. works just like the `--files-from=FILE-OF-NAMES' (`-T FILE-OF-NAMES')
  399. option: specify the name of a file as EXCLUDE-LIST which contains the
  400. list of patterns you want to exclude.
  401. FIXME: xref Regular Expressions
  402.    for more information on the syntax and meaning of regular
  403. expressions.
  404. File: tar.info,  Node: Operating Only on New Files,  Next: Crossing Filesystem Boundaries,  Prev: Excluding Some Files,  Up: Characteristics
  405. Operating Only on New Files
  406. ---------------------------
  407.      *(This message will disappear, once this node revised.)*
  408.    The `--after-date=DATE' (`-N DATE') or `--newer=DATE' limits `tar'
  409. to only operating on files which have been modified after the date
  410. specified.  (For more information on how to specify a date,
  411. FIXME: xref Date Formats
  412.    .)  A file is considered to have changed if the contents have been
  413. modified, or if the owner, permissions, and so forth, have been changed.
  414.    If you only want `tar' make the date comparison on the basis of the
  415. actual contents of the file's modification, then use the
  416. `--newer-mtime=DATE' option.
  417.    You should never use this option for making incremental dumps.  To
  418. learn how to use `tar' to make backups,
  419. FIXME: ref Making Backups
  420. File: tar.info,  Node: Crossing Filesystem Boundaries,  Prev: Operating Only on New Files,  Up: Characteristics
  421. Crossing Filesystem Boundaries
  422. ------------------------------
  423.      *(This message will disappear, once this node revised.)*
  424.    The `--one-file-system' (`-l') option causes `tar' to modify its
  425. normal behavior in archiving the contents of directories.  If a file in
  426. a directory is not on the same filesystem as the directory itself
  427. (because it is a mounted filesystem in its own right), then `tar' will
  428. not archive that file, or (if it is a directory itself) anything
  429. beneath it.
  430.    This does not necessarily limit `tar' to only archiving the contents
  431. of a single filesystem, because all files named on the command line, or
  432. through the `--files-from=FILE-OF-NAMES' (`-T FILE-OF-NAMES') option,
  433. will always be archived.
  434. File: tar.info,  Node: Selection Options,  Prev: Characteristics,  Up: Specifying Names to tar
  435. Local file selection
  436. ====================
  437.      *(This message will disappear, once this node revised.)*
  438.    Local file selection
  439. `-C DIR'
  440. `--directory DIR'
  441.      Change to directory DIR.
  442.      This option causes `tar' to change into the directory DIR before
  443.      continuing.  This option can be interspersed with the files `tar'
  444.      is to work on.  For example,
  445.           tar -c iggy ziggy -C baz melvin
  446.      will place the files `iggy' and `ziggy' from the current directory
  447.      on the tape, followed by the file `melvin' from the directory
  448.      `baz'.  This option is especially useful when you have several
  449.      widely separated files that you want to store in the same
  450.      directory in the archive.
  451.      Here, the file `melvin' is recorded in the archive under the
  452.      precise name `melvin', *not* `baz/melvin'.  Thus, the archive will
  453.      contain three files that all appear to have come from the same
  454.      directory; if the archive is extracted with plain `tar -x', all
  455.      three files will be created in the current directory.
  456.      Contrast this with the command:
  457.           tar -c iggy ziggy bar/melvin
  458.      which records the third file in the archive under the name
  459.      `bar/melvin' so that, if plain `tar -x' is used, the third file
  460.      will be created in a subdirectory named `bar'.
  461.      Suppose that, without changing your current directory, you want to
  462.      call `tar' to dump files from `/users/ctd/dipp' say.  Then
  463.      `--directory=DIRECTORY' (`-C DIRECTORY') is for you.  You could do
  464.      things like:
  465.           tar cfC archive.tar /users/ctd/dipp .
  466.      (the `.' means the current directory, once the
  467.      `--directory=DIRECTORY' (`-C DIRECTORY') obeyed).
  468.      Some people might want some option to extract everything from an
  469.      archive in the current directory, ignore directory structure in
  470.      the archive.  This is so rarely proper that I doubt such an option
  471.      would be really useful.  It would only help getting around improper
  472.      `tar' usage, it might even encourage improper usage.  In general,
  473.      `--directory=DIRECTORY' (`-C DIRECTORY') might be used to produce
  474.      archives with a cleaner structure in the first place.
  475. `-T FILENAME'
  476. `--files-from=FILENAME'
  477.      Get names to extract or create from file FILENAME.
  478.      Instead of taking the list of files to work on from the command
  479.      line, the list of files to work on is read from the file FILENAME.
  480.      If FILENAME is given as `-', the list is read from standard input.
  481.      Note that using both `-T -' and `-f -' will not work unless you
  482.      are using the `--create' (`-c') command.
  483.      This is typically useful when you have generated the list of files
  484.      to archive with `find'.
  485. `--null'
  486.      This option causes `--files-from=FILE-OF-NAMES' (`-T
  487.      FILE-OF-NAMES') to read file names terminated by a NUL instead of
  488.      a newline, so files whose names contain newlines can be archived
  489.      using `--files-from=FILE-OF-NAMES' (`-T FILE-OF-NAMES').  The
  490.      `--null' option is just like the one in GNU `xargs' and `cpio',
  491.      and is useful with the `-print0' predicate of GNU `find'.  In
  492.      `tar', `--null' also causes `--directory=DIRECTORY' (`-C
  493.      DIRECTORY') options to be treated as file names to archive, in
  494.      case there are any files out there called `-C'.
  495. `--exclude=FILE'
  496.      Exclude file FILE.
  497. `-X FILE'
  498. `--exclude-from=FILE'
  499.      Exclude files listed in FILE.
  500.      This option causes `tar' to read a list of regular expressions (in
  501.      shell wildcard syntax), one per line, from FILE; `tar' will ignore
  502.      files matching those regular expressions.  Thus if `tar' is called
  503.      as `tar -c -X foo .' and the file `foo' contains a single line
  504.      `*.o', no files whose names end in `.o' will be added to the
  505.      archive.  Multiple `--exclude=PATTERN' options may be given.
  506. `--absolute-names'
  507.      Do not strip leading `/'s from file names.
  508.      By default, GNU `tar' drops a leading `/' on input or output.
  509.      This option turns off this behavior; it's equivalent to changing
  510.      to the root directory before running `tar' (except it also turns
  511.      off the usual warning message).
  512. `--one-file-system'
  513.      Stay in local filesystem when creating archive.
  514.      This option causes `tar' to not cross filesystem boundaries when
  515.      archiving parts of a directory tree.  This option only affects
  516.      files that are archived because they are in a directory that is
  517.      archived; files named on the command line are archived regardless,
  518.      and they can be from various file systems.
  519.      This option is useful for making full or incremental archival
  520.      backups of a filesystem, as with the Unix `dump' command.
  521.      Files skipped due to this option are mentioned on standard error.
  522. `-K NAME'
  523. `--starting-file=NAME'
  524.      Begin at file NAME in the archive.
  525.      The `--starting-file=NAME' (`-K NAME') option causes `tar' to begin
  526.      extracting or listing the archive with the file FILENAME, and to
  527.      consider only the files starting at that point in the archive.
  528.      This is useful if a previous attempt to extract files failed when
  529.      it reached FILENAME due to lack of free space.  (Assuming, of
  530.      course, that there is now free space, or that you are now
  531.      extracting into a different file system.)
  532. `-N DATE'
  533. `--newer=DATE'
  534. `--after-date=DATE'
  535.      Only store files newer than DATE.
  536.      This option causes `tar' to only work on files whose modification
  537.      or inode-changed times are newer than the DATE given.  The main
  538.      use is for creating an archive; then only new files are written.
  539.      If extracting, only newer files are extracted.
  540.      Remember that the entire date argument must be quoted if it
  541.      contains any spaces.
  542.      The date is parsed using `getdate'.
  543.    Changing the Names of Members when Archiving
  544. * Menu:
  545. * Changing Directory::
  546. * Absolute File Names::
  547. File: tar.info,  Node: Changing Directory,  Next: Absolute File Names,  Prev: Selection Options,  Up: Selection Options
  548. Changing Directory
  549. ------------------
  550.      *(This message will disappear, once this node revised.)*
  551.    The `--directory=DIRECTORY' (`-C DIRECTORY') option causes `tar' to
  552. change its current working directory to DIRECTORY.  Unlike most
  553. options, this one is processed at the point it occurs within the list
  554. of files to be processed.  Consider the following command:
  555.      tar --create --file=foo.tar -C /etc passwd hosts -C /lib libc.a
  556.    This command will place the files `/etc/passwd', `/etc/hosts', and
  557. `/lib/libc.a' into the archive.  However, the names of the archive
  558. members will be exactly what they were on the command line: `passwd',
  559. `hosts', and `libc.a'.  The `--directory=DIRECTORY' (`-C DIRECTORY')
  560. option is frequently used to make the archive independent of the
  561. original name of the directory holding the files.
  562.    Note that `--directory=DIRECTORY' (`-C DIRECTORY') options are
  563. interpreted consecutively.  If `--directory=DIRECTORY' (`-C DIRECTORY')
  564. option specifies a relative file name, it is interpreted relative to
  565. the then current directory, which might not be the same as the original
  566. current working directory of `tar', due to a previous
  567. `--directory=DIRECTORY' (`-C DIRECTORY') option.
  568.    When using `--files-from=FILE-OF-NAMES' (`-T FILE-OF-NAMES') (
  569. FIXME: pxref Reading Names from a File
  570.    ), you can put `-C' options in the file list.  Unfortunately, you
  571. cannot put `--directory' options in the file list.  (This interpretation
  572. can be disabled by using the `--null' option.)
  573.    Changing the Working Directory Within a List of File Names
  574.      *(This message will disappear, once this node revised.)*
  575.    To change working directory in the middle of a list of file names,
  576. either on the command line or in a file specified using
  577. `--files-from=FILE-OF-NAMES' (`-T FILE-OF-NAMES'), use
  578. `--directory=DIRECTORY' (`-C DIRECTORY').  This will change the working
  579. directory to the directory DIRECTORY after that point in the list.  For
  580. example,
  581.      tar --create iggy ziggy --directory=baz melvin
  582. will place the files `iggy' and `ziggy' from the current directory into
  583. the archive, followed by the file `melvin' from the directory `baz'.
  584. This option is especially useful when you have several widely separated
  585. files that you want to store in the same directory in the archive.
  586.    Note that the file `melvin' is recorded in the archive under the
  587. precise name `melvin', *not* `baz/melvin'.  Thus, the archive will
  588. contain three files that all appear to have come from the same
  589. directory; if the archive is extracted with plain `tar --extract', all
  590. three files will be written in the current directory.
  591.    Contrast this with the command
  592.      tar -c iggy ziggy bar/melvin
  593. which records the third file in the archive under the name `bar/melvin'
  594. so that, if the archive is extracted using `tar --extract', the third
  595. file will be written in a subdirectory named `bar'.
  596. `--directory=`directory''
  597. `-C `directory''
  598.      Changes the working directory.
  599. FIXME: need to test how extract deals with this, and add an example
  600. File: tar.info,  Node: Absolute File Names,  Prev: Changing Directory,  Up: Selection Options
  601. Absolute File Names
  602. -------------------
  603.      *(This message will disappear, once this node revised.)*
  604.    When `tar' extracts archive members from an archive, it strips any
  605. leading slashes (`/') from the member name.  This causes absolute
  606. member names in the archive to be treated as relative file names.  This
  607. allows you to have such members extracted wherever you want, instead of
  608. being restricted to extracting the member in the exact directory named
  609. in the archive.  For example, if the archive member has the name
  610. `/etc/passwd', `tar' will extract it as if the name were really
  611. `etc/passwd'.
  612.    Other `tar' programs do not do this.  As a result, if you create an
  613. archive whose member names start with a slash, they will be difficult
  614. for other people with an inferior `tar' program to use.  Therefore, GNU
  615. `tar' also strips leading slashes from member names when putting
  616. members into the archive.  For example, if you ask `tar' to add the
  617. file `/bin/ls' to an archive, it will do so, but the member name will
  618. be `bin/ls'.
  619.    If you use the `--absolute-names' (`-P') option, `tar' will do
  620. neither of these transformations.
  621. FIXME: is this what this does, or does it just preserve the slash?
  622.    To archive or extract files relative to the root directory, specify
  623. the `--absolute-names' (`-P') option.
  624.    Normally, `tar' acts on files relative to the working
  625. directory--ignoring superior directory names when archiving, and
  626. ignoring leading slashes when extracting.
  627.    When you specify `--absolute-names' (`-P'), `tar' stores file names
  628. including all superior directory names, and preserves leading slashes.
  629. If you only invoked `tar' from the root directory you would never need
  630. the `--absolute-names' (`-P') option, but using this option may be more
  631. convenient than switching to root.
  632. FIXME: should be an example in the tutorial/wizardry section using this
  633. FIXME: to transfer files between systems.
  634. FIXME: is write access an issue?
  635. `--absolute-names'
  636.      Preserves full file names (inclusing superior dirctory names) when
  637.      archiving files.  Preserves leading slash when extracting files.
  638. File: tar.info,  Node: Being Careful,  Next: Format Control,  Prev: Specifying Names to tar,  Up: Top
  639. Being Even More Careful
  640. ***********************
  641. * Menu:
  642. * Documentation::
  643. * Checking Progress::
  644. * Interactive Operation::
  645. * Write Verification::
  646. * Comparing::
  647. * Portability::
  648. * Write Protection::
  649. File: tar.info,  Node: Documentation,  Next: Checking Progress,  Prev: Being Careful,  Up: Being Careful
  650. GNU `tar' documentation
  651. =======================
  652.    Being careful, the first thing is really checking that you are using
  653. GNU `tar', indeed.  The `--version' option will generate a message
  654. giving confirmation that you are using GNU `tar', with the precise
  655. version of GNU `tar' you are using.  `tar' identifies itself and prints
  656. the version number to the standard output, then immediately exits
  657. successfully, without doing anything else, ignoring all other options.
  658. For example, `tar --version' might return:
  659.      GNU tar version 1.11.8
  660.    Another thing you might want to do is checking the spelling or
  661. meaning of some particular `tar' option, without resorting to this
  662. manual, for once you have carefully read it.  GNU `tar' has a short help
  663. feature, triggerable through the `--help' option.  By using this
  664. option, `tar' will print a usage message listing all available options
  665. on standard output, then exit successfully, without doing anything else
  666. and ignoring all other options.  Even if this is only a brief summary,
  667. it may be several screens long.  So, if you are not using some kind of
  668. scrollable window, you might prefer to use something like:
  669.      tar --help | less
  670. presuming, here, that you like using `less' for a pager.  Other popular
  671. pagers are `more' and `pg'.
  672.    The perceptive reader would have noticed some contradiction in the
  673. previous paragraphs.  It is written that both `--version' and `--help'
  674. print something, and have all other options ignored.  In fact, they
  675. cannot ignore each other, and one of them has to win.  We do not
  676. specify which is stronger, here; experiment if you really wonder!
  677.    The short help output is quite succint, and you might have to get
  678. back to the full documentation for precise points.  If you are reading
  679. this paragraph, you already have the `tar' manual in some form.  This
  680. manual is available in printed form, as a kind of small book.  It may
  681. printed out of the GNU `tar' distribution, provided you have TeX
  682. already installed somewhere, and a laser printer around.  Just configure
  683. the distribution, execute the command `make dvi', then print
  684. `doc/tar.dvi' the usual way (contact your local guru to know how).  If
  685. GNU `tar' has been conveniently installed at your place, this manual is
  686. also available in interactive, hypertextual form as an Info file.  Just
  687. call `info tar' or, if you do not have the `info' program handy, use
  688. the Info reader provided within GNU Emacs, calling `tar' from the main
  689. Info menu.
  690. File: tar.info,  Node: Checking Progress,  Next: Interactive Operation,  Prev: Documentation,  Up: Being Careful
  691. Checking `tar' progress
  692. =======================
  693.    Typically, `tar' performs most operations without reporting any
  694. information to the user except error messages.  When using `tar' with
  695. many options, particularly ones with complicated or
  696. difficult-to-predict behavior, it is possible to make serious mistakes.
  697. `tar' provides several options that make observing `tar' easier.  These
  698. options cause `tar' to print information as it progresses in its job,
  699. and you might want to use them just for being more careful about what
  700. is going on, or merely for entertaining yourself.  If you have
  701. encountered a problem when operating on an archive, however, you may
  702. need more information than just an error message in order to solve the
  703. problem.  The following options can be helpful diagnostic tools.
  704.    Normally, the `--list' (`-t') command to list an archive prints just
  705. the file names (one per line) and the other commands are silent.  When
  706. used with most operations, the `--verbose' (`-v') option causes `tar'
  707. to print the name of each file or archive member as it is processed.
  708. This and the other options which make `tar' print status information
  709. can be useful in monitoring `tar'.
  710.    With `--create' (`-c') or `--extract' (`-x'), `--verbose' (`-v')
  711. used once just prints the names of the files or members as they are
  712. processed.  Using it twice causes `tar' to print a longer listing
  713. (reminiscent of `ls -l') for each member.  Since `--list' (`-t')
  714. already prints the names of the members, `--verbose' (`-v') used once
  715. with `--list' (`-t') causes `tar' to print an `ls -l' type listing of
  716. the files in the archive.  The following examples both extract members
  717. with long list output:
  718.      tar --extract --file=archive.tar --verbose --verbose
  719.      tar xvv archive.tar
  720.    Verbose output appears on the standard output except when an archive
  721. is being written to the standard output, as with `tar --create --file=-
  722. --verbose' (`tar cfv -', or even `tar cv'--if the installer let
  723. standard output be the default archive).  In that case `tar' writes
  724. verbose output to the standard error stream.
  725.    The `--totals' option--which is only meaningful when used with
  726. `--create' (`-c')--causes `tar' to print the total amount written to
  727. the archive, after it has been fully created.
  728.    The `--checkpoint' option prints an occasional message as `tar'
  729. reads or writes the archive.  In fact, it print directory names while
  730. reading the archive.  It is designed for those who don't need the more
  731. detailed (and voluminous) output of `--record-number' (`-R'), but do
  732. want visual confirmation that `tar' is actually making forward progress.
  733. FIXME: There is some confusion here.  It seems that -R once wrote a
  734. FIXME: message at `every' block read or written.
  735.    The `--show-omitted-dirs' option, when reading an archive--with
  736. `--list' (`-t') or `--extract' (`-x'), for example--causes a message to
  737. be printed for each directory in the archive which is skipped.  This
  738. happens regardless of the reason for skipping: the directory might not
  739. have been named on the command line (implicitly or explicitly), it
  740. might be excluded by the use of the `--exclude=PATTERN' option, or some
  741. other reason.
  742.    If `--record-number' (`-R') is used, `tar' prints, along with every
  743. message it would normally produce, the record number within the archive
  744. where the message was triggered.  This option is especially useful when
  745. reading damaged archives, since it helps pinpoint the damaged sections.
  746. It can also be used with `--list' (`-t') when listing a file-system
  747. backup tape, allowing you to choose among several backup tapes when
  748. retrieving a file later, in favor of the tape where the file appears
  749. earliest (closest to the front of the tape).
  750. FIXME: xref when the node name is set and the backup section written
  751. File: tar.info,  Node: Interactive Operation,  Next: Write Verification,  Prev: Checking Progress,  Up: Being Careful
  752. Asking for Confirmation During Operations
  753. =========================================
  754.    Typically, `tar' carries out a command without stopping for further
  755. instructions.  In some situations however, you may want to exclude some
  756. files and archive members from the operation (for instance if disk or
  757. storage space is tight).  You can do this by excluding certain files
  758. automatically (
  759. FIXME: pxref File Exclusion
  760.    ), or by performing an operation interactively, using the
  761. `--interactive' (`-w') option.  `tar' also accepts `--confirmation' for
  762. this option.
  763.    When the `--interactive' (`-w') option is specified, before reading,
  764. writing, or deleting files, `tar' first prints a message for each such
  765. file, telling what operation it intends to take, then asks for
  766. confirmation on the terminal.  The actions which require confirmation
  767. include adding a file to the archive, extracting a file from the
  768. archive, deleting a file from the archive, and deleting a file from
  769. disk.  To confirm the action, you must type a line of input beginning
  770. with `y'.  If your input line begins with anything other than `y',
  771. `tar' skips that file.
  772.    If `tar' is reading the archive from the standard input, `tar' opens
  773. the file `/dev/tty' to support the interactive communications.
  774. File: tar.info,  Node: Write Verification,  Next: Comparing,  Prev: Interactive Operation,  Up: Being Careful
  775. Verifying Data as It is Stored
  776. ==============================
  777.    You can insure the accuracy of an archive by comparing files in the
  778. system with archive members.  `tar' can compare an archive to the file
  779. system as the archive is being written, to verify a write operation, or
  780. can compare a previously written archive, to insure that it is up to
  781. date.
  782.    To check for discrepancies in an archive immediately after it is
  783. written, use the `--verify' (`-W') option in conjunction with the
  784. `--create' (`-c') operation.  When this option is specified, `tar'
  785. checks archive members against their counterparts in the file system,
  786. and reports discrepancies on the standard error.  In multi-volume
  787. archives, each volume is verified after it is written, before the next
  788. volume is written.
  789.    To verify an archive, you must be able to read it from before the end
  790. of the last written entry.  This option is useful for detecting data
  791. errors on some tapes.  Archives written to pipes, some cartridge tape
  792. drives, and some other devices cannot be verified.
  793. File: tar.info,  Node: Comparing,  Next: Portability,  Prev: Write Verification,  Up: Being Careful
  794. Comparing an Archive with the File System
  795. =========================================
  796.      *(This message will disappear, once this node revised.)*
  797.    `--compare' (`-d') compares archive members in an existing archive
  798. with their counterparts in the file system, and reports differences in
  799. file size, mode, owner, modification date and contents.  If a file is
  800. represented in the archive but does not exist in the file system, `tar'
  801. reports a difference.
  802.    If you use FILE NAME arguments in conjunction with `tar --compare',
  803. `tar' compares the archived versions of the files specified with their
  804. counterparts in the file system.  If you specify a file that is not in
  805. the archive, `tar' will report an error.  If you don't specify any
  806. files, `tar' compares all the files in the archive.
  807.    Because `tar' only checks files in the archive against files in the
  808. file system, and not vice versa, it ignores files in the file system
  809. that do not exist in the archive.
  810.    The following example compares the archive members `larry', `moe'
  811. and `curly' in the archive `stooges' with files of the same name in the
  812. file system.
  813.      tar --compare --file=stooges larry moe curly
  814. If a file, for example `curly', did not exist in the archive, `tar'
  815. would report an error, as follows:
  816.      curly: does not exist
  817. File: tar.info,  Node: Portability,  Next: Write Protection,  Prev: Comparing,  Up: Being Careful
  818. Making `tar' Archives More Portable
  819. ===================================
  820.    Creating a `tar' archive on a particular system, meant to be later
  821. useful on many other machines and with other versions of `tar', is more
  822. a challenge than you might think.  `tar' archive formats evolved since
  823. the first versions of Unix, many such formats are flying around, not
  824. always comptabile between them.  This section wants to discuss a few
  825. problems, and give some advice, for making `tar' archives more portable.
  826.    One golden rule is simplicity.  For example, limit your `tar'
  827. archives to contain only regular files and directories, avoiding other
  828. kind of special files.  Do not attempt to save sparse files or
  829. contiguous files as such.  Let's discuss a few more problems, in turn.
  830. * Menu:
  831. * Portable Names::
  832. * Symbolic Links::
  833. * Old V7 and POSIX::
  834. * Checksumming Problems::
  835. File: tar.info,  Node: Portable Names,  Next: Symbolic Links,  Prev: Portability,  Up: Portability
  836. Portable Names
  837. --------------
  838.    Use *straight* file and directory names, made up of printable ASCII
  839. characters, avoiding colons, slashes, backslashes, and other
  840. *dangerous* characters.  Avoid deep directory nesting.  Accounting for
  841. oldish System V machines, limit your file and directory names to 14
  842. characters or less.
  843.    If you intend to have your `tar' archives to be read under MSDOS,
  844. you should not rely on case distinction for file names, and you might
  845. use the GNU `doschk' program for helping you further diagnosing illegal
  846. MSDOS names, which are even more limited than System V's.
  847. File: tar.info,  Node: Symbolic Links,  Next: Old V7 and POSIX,  Prev: Portable Names,  Up: Portability
  848. Symbolic Links
  849. --------------
  850.    Normally, when `tar' archives a symbolic link, it writes a record to
  851. the archive naming the target of the link.  In that way, the `tar'
  852. archive is a faithful record of the filesystem contents.
  853. `--dereference' (`-h') is used with `--create' (`-c'), and causes `tar'
  854. to archive the files symbolic links point to, instead of the links
  855. themselves.  When this option is used, when `tar' encounters a symbolic
  856. link, it will archive the linked-to file, instead of simply recording
  857. the presence of a symbolic link.
  858.    The name under which the file is stored in the file system is not
  859. recorded in the archive.  To record both the symbolic link name and the
  860. file name in the system, archive the file under both names.  If all
  861. links were recorded automatically by `tar', an extracted file might be
  862. linked to a file name that no longer exists in the file system.
  863.    If a linked-to file is encountered again by `tar' while creating the
  864. same archive, an entire second copy of it will be stored.  (This
  865. *might* be considered a bug.)
  866.    So, for portable archives, do not archive symbolic links as such,
  867. and use `--dereference' (`-h'): many systems do not support symbolic
  868. links, and moreover, your distribution might be unusable if it contains
  869. unresolved symbolic links.
  870. File: tar.info,  Node: Old V7 and POSIX,  Next: Checksumming Problems,  Prev: Symbolic Links,  Up: Portability
  871. Old V7 and POSIX Archives
  872. -------------------------
  873.    GNU `tar' implements an early draft of the POSIX 1003.1 `ustar'
  874. standard which is different from the final standard.  Adding support
  875. for the new changes in a backward-compatible fashion is not trivial.
  876.    Certain old versions of `tar' cannot handle additional information
  877. recorded by newer `tar' programs.  To create an archive in V7 format
  878. (not ANSI), which can be read by these old versions, specify the
  879. `--old-archive' (`-o') option in conjunction with the `--create'
  880. (`-c').  `tar' also accepts `--portability' for this option.  When you
  881. specify it, `tar' leaves out information about directories, pipes,
  882. fifos, contiguous files, and device files, and specifies file ownership
  883. by group and user IDs instead of group and user names.
  884.    When updating an archive, do not use `--old-archive' (`-o') unless
  885. the archive was created with using this option.
  886.    In most cases, a *new* format archive can be read by an *old* `tar'
  887. program without serious trouble, so this option should seldom be
  888. needed.  On the other hand, most modern `tar's are able to read old
  889. format archives, so it might be safer for you to always use
  890. `--old-archive' (`-o') for your distributions.
  891.