Skip to main content

14.7) Creating "tar" Files


Go to your home directory (type cd and hit return), make a directory called test and put a few files in that directory. Now return to the home directory and tar the directory called test by typing:

tar   –cvf    files.tar   test

Now you have a file called files.tar that contains all the files and the directory info of test. You could transfer this files.tar to someone else or put it on another computer of yours (you will see how to later). How can we check that if you extract everything from this file into another location, it will produce the same as what was in the original directory called test? If we extract in the home directory it will cause trouble since the test directory is already there. We can make a new directory called ‘check’ and put the ‘files.tar’ in that directory and then extract and check there.