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

2.6.1 Preparing a Practice Directory for Examples

To follow along with this and future examples, create a new directory called ‘practice’ containing files called ‘blues’, ‘folk’ and ‘jazz’. The files can contain any information you like: ideally, they should contain information which relates to their names, and be of different lengths. Our examples assume that ‘practice’ is a subdirectory of your home directory.

Now cd to the directory named ‘practice’; ‘practice’ is now your working directory. (Please note: Although the full file name of this directory is ‘/homedir/practice’, in our examples we will refer to this directory as ‘practice’; the homedir is presumed.)

In general, you should check that the files to be archived exist where you think they do (in the working directory) by running ls. Because you just created the directory and the files and have changed to that directory, you probably don’t need to do that this time.

It is very important to make sure there isn’t already a file in the working directory with the archive name you intend to use (in this case, ‘collection.tar’), or that you don’t care about its contents. Whenever you use ‘create’, tar will erase the current contents of the file named by ‘--file=archive-name’ (‘-f archive-name’) if it exists. tar will not tell you if you are about to overwrite an archive unless you specify an option which does this (see section Backup options, for the information on how to do so). To add files to an existing archive, you need to use a different option, such as ‘--append’ (‘-r’); see How to Add Files to Existing Archives: ‘--append for information on how to do this.


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

This document was generated on August 23, 2023 using texi2html 5.0.