Copyright (C) 2000-2012 |
GNU Info (tar.info)Creating the archiveCreating the Archive -------------------- To place the files `blues', `folk', and `jazz' into an archive named `collection.tar', use the following command: $ tar --create --file=collection.tar blues folk jazz The order of the arguments is not very important, _when using long option forms_. You could also say: $ tar blues --create folk --file=collection.tar jazz However, you can see that this order is harder to understand; this is why we will list the arguments in the order that makes the commands easiest to understand (and we encourage you to do the same when you use `tar', to avoid errors). Note that the part of the command which says, `--file=collection.tar' is considered to be _one_ argument. If you substituted any other string of characters for `collection.tar', then that string would become the name of the archive file you create. The order of the options becomes more important when you begin to use short forms. With short forms, if you type commands in the wrong order (even if you type them correctly in all other ways), you may end up with results you don't expect. For this reason, it is a good idea to get into the habit of typing options in the order that makes inherent sense. Note: short create, for more information on this. In this example, you type the command as shown above: `--create' is the operation which creates the new archive (`collection.tar'), and `--file' is the option which lets you give it the name you chose. The files, `blues', `folk', and `jazz', are now members of the archive, `collection.tar' (they are "file name arguments" to the `--create' operation). Now that they are in the archive, they are called _archive members_, not files. When you create an archive, you _must_ specify which files you want placed in the archive. If you do not specify any archive members, GNU `tar' will complain. If you now list the contents of the working directory (`ls'), you will find the archive file listed as well as the files you saw previously: blues folk jazz collection.tar Creating the archive `collection.tar' did not destroy the copies of the files in the directory. Keep in mind that if you don't indicate an operation, `tar' will not run and will prompt you for one. If you don't name any files, `tar' will complain. You must have write access to the working directory, or else you will not be able to create an archive in that directory. _Caution_: Do not attempt to use `--create' (`-c') to add files to an existing archive; it will delete the archive and write a new one. Use `--append' (`-r') instead. Note: append. automatically generated by info2www version 1.2.2.9 |