manpagez: man pages & more
info tar
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2 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. See section The Five Advanced tar Operations.

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 a file name begins with dash (‘-’), precede it with ‘--add-file’ option to prevent it from being treated as an option.

By default GNU tar attempts to unquote each file or member name, replacing escape sequences according to the following table:

EscapeReplaced with
\aAudible bell (ASCII 7)
\bBackspace (ASCII 8)
\fForm feed (ASCII 12)
\nNew line (ASCII 10)
\rCarriage return (ASCII 13)
\tHorizontal tabulation (ASCII 9)
\vVertical tabulation (ASCII 11)
\?ASCII 127
\nASCII n (n should be an octal number of up to 3 digits)

A backslash followed by any other symbol is retained.

This default behavior is controlled by the following command line option:

--unquote

Enable unquoting input file or member names (default).

--no-unquote

Disable unquoting input file or member names.

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, tar behavior differs depending on the operation mode as described below:

When tar is invoked with ‘--create’ (‘-c’), tar will stop immediately, reporting the following:

$ tar cf a.tar
tar: Cowardly refusing to create an empty archive
Try 'tar --help' or 'tar --usage' for more information.

If you specify either ‘--list’ (‘-t’) or ‘--extract’ (‘--get’, ‘-x’), tar operates on all the archive members in the archive.

If run with ‘--diff’ option, tar will compare the archive with the contents of the current working directory.

If you specify any other operation, tar does nothing.

By default, tar takes file names from the command line. However, there are other ways 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.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on November 1, 2013 using texi2html 5.0.

© manpagez.com 2000-2017
Individual documents may contain additional copyright information.