tar: Creating the archive

1 
1 2.6.2 Creating the Archive
1 --------------------------
1 
1 To place the files 'blues', 'folk', and 'jazz' into an archive named
1 'collection.tar', use the following command:
1 
1      $ tar --create --file=collection.tar blues folk jazz
1 
1    The order of the arguments is not very important, _when using long
1 option forms_, however you should always remember to use option as the
1 first argument to tar.  For example, the following is wrong:
1 
1      $ tar blues -c folk -f collection.tar jazz
1      tar: -c: Invalid blocking factor
1      Try 'tar --help' or 'tar --usage' for more information.
1 
1    The error message is produced because 'tar' always treats its first
1 argument as an option (or cluster of options), even if it does not start
1 with dash.  This is "traditional" or "old option" style, called so
1 because all implementations of 'tar' have used it since the very
1 inception of the tar archiver in 1970s.  This option style will be
1 explained later (⇒Old Options), for now just remember to always
1 place option as the first argument.
1 
1    That being said, you could issue the following command:
1 
1      $ tar --create folk blues --file=collection.tar jazz
1 
1 However, you can see that this order is harder to understand; this is
1 why we will list the arguments in the order that makes the commands
1 easiest to understand (and we encourage you to do the same when you use
1 'tar', to avoid errors).
1 
1    Note that the sequence '--file=collection.tar' is considered to be
1 _one_ argument.  If you substituted any other string of characters for
1 'collection.tar', then that string would become the name of the archive
1 file you create.
1 
1    The order of the options becomes more important when you begin to use
1 short forms.  With short forms, if you type commands in the wrong order
1 (even if you type them correctly in all other ways), you may end up with
1 results you don't expect.  For this reason, it is a good idea to get
1 into the habit of typing options in the order that makes inherent sense.
1 ⇒short create, for more information on this.
1 
1    In this example, you type the command as shown above: '--create' is
1 the operation which creates the new archive ('collection.tar'), and
1 '--file' is the option which lets you give it the name you chose.  The
1 files, 'blues', 'folk', and 'jazz', are now members of the archive,
1 'collection.tar' (they are "file name arguments" to the '--create'
1 operation.  ⇒Choosing, for the detailed discussion on these.)
1 Now that they are in the archive, they are called _archive members_, not
1 files.  (⇒members Definitions.).
1 
1    When you create an archive, you _must_ specify which files you want
1 placed in the archive.  If you do not specify any archive members, GNU
1 'tar' will complain.
1 
1    If you now list the contents of the working directory ('ls'), you
1 will find the archive file listed as well as the files you saw
1 previously:
1 
1      blues   folk   jazz   collection.tar
1 
1 Creating the archive 'collection.tar' did not destroy the copies of the
1 files in the directory.
1 
1    Keep in mind that if you don't indicate an operation, 'tar' will not
1 run and will prompt you for one.  If you don't name any files, 'tar'
1 will complain.  You must have write access to the working directory, or
1 else you will not be able to create an archive in that directory.
1 
1    _Caution_: Do not attempt to use '--create' ('-c') to add files to an
1 existing archive; it will delete the archive and write a new one.  Use
1 '--append' ('-r') instead.  ⇒append.
1