Examples of creating an archive file

To create a tarfile containing several files:

   tar cvf data.tar *.dat

This creates a tarfile data.tar containing all the files in the current directory which have the filename extension .dat.

Look at the manual page for details of the command options cvf.


To create a tarfile of a directory:

   tar cvf project.tar Project
   Project/README
   Project/Makefile
   Project/Makefile
   Project/main.c
   Project/screen.c
   Project/menus.c
   Project/calculator.c
   Project/setup/configuration

This creates a tarfile project.tar which contains the directory Project and its contents.

To create a tarfile containing several directories:

   tar cvf book.tar text illustrations

This creates a tarfile book.tar containing the directories text and illustrations.


[Home] [Index]