Home Explore Blog CI



man-pages

2nd chunk of `tar.man`
9d8f014909254363077e911261e9a30f8f6f3ad0ab5301750000000100000fcf
 operate upon.  The following command, writ‐
       ten in the traditional style, instructs tar to store all files from the directory /etc into the archive file etc.tar verbosely listing the files being archived:

       tar cfv etc.tar /etc

       In  UNIX  or short‐option style, each option letter is prefixed with a single dash, as in other command line utilities.  If an option takes argument, the argument follows it, either as a separate command line word, or
       immediately following the option.  However, if the option takes an optional argument, the argument must follow the option letter without any intervening whitespace, as in -g/tmp/snar.db.

       Any number of options not taking arguments can be clustered together after a single dash, e.g. -vkp.  Options that take arguments (whether mandatory or optional), can appear at the end of such a  cluster,  e.g.  -vkpf
       a.tar.

       The example command above written in the short‐option style could look like:

       tar ‐cvf etc.tar /etc
       or
       tar ‐c ‐v ‐f etc.tar /etc

       In  GNU  or long‐option style, each option begins with two dashes and has a meaningful name, consisting of lower‐case letters and dashes.  When used, the long option can be abbreviated to its initial letters, provided
       that this does not create ambiguity.  Arguments to long options are supplied either as a separate command line word, immediately following the option, or separated from the option by an equals sign with no intervening
       whitespace.  Optional arguments must always use the latter method.

       Here are several ways of writing the example command in this style:

       tar ‐‐create ‐‐file etc.tar ‐‐verbose /etc
       or (abbreviating some options):
       tar ‐‐cre ‐‐file=etc.tar ‐‐verb /etc

       The options in all three styles can be intermixed, although doing so with old options is not encouraged.

   Operation mode
       The options listed in the table below tell GNU tar what operation it is to perform.  Exactly one of them must be given.  Meaning of non‐optional arguments depends on the operation mode requested.

       -A, --catenate, --concatenate
              Append archive to the end of another archive.  The arguments are treated as the names of archives to append.  All archives must be of the same format as the archive they are appended to, otherwise the resulting
              archive might be unusable with non‐GNU implementations of tar.  Notice also that when more than one archive is given, the members from archives other than the first one  will  be  accessible  in  the  resulting
              archive only if using the -i (--ignore-zeros) option.

              Compressed archives cannot be concatenated.

       -c, --create
              Create a new archive.  Arguments supply the names of the files to be archived.  Directories are archived recursively, unless the --no-recursion option is given.

       -d, --diff, --compare
              Find differences between archive and file system.  The arguments are optional and specify archive members to compare.  If not given, the current working directory is assumed.

       --delete
              Delete from the archive.  The arguments supply names of the archive members to be removed.  At least one argument must be given.

              This option does not operate on compressed archives.  There is no short option equivalent.

       -r, --append
              Append files to the end of an archive.  Arguments have the same meaning as for -c (--create).

       -t, --list
              List the contents of an archive.  Arguments are optional.  When given, they specify the names of the members to list.

       --test-label
              Test  the  archive  volume label and exit.  When used without arguments, it prints the volume label (if any) and exits with status 0.  When one or more command line arguments are given.  tar compares the volume
              label with each argument.  It exits

Title: GNU tar: Option Styles and Operation Modes
Summary
This section of the GNU tar man page details the different option styles: UNIX-style (short options) with single dashes, and GNU-style (long options) with double dashes. It explains how arguments are passed with each style and shows examples. Additionally, it outlines the operation modes available with GNU tar, which specify the action to be performed, such as appending archives (-A), creating archives (-c), comparing archives with the file system (-d), deleting members from an archive (--delete), appending files to an archive (-r), and listing archive contents (-t). It also describes the --test-label option.