For example, create a handin directory, cp all the files to tar up into this directory, and tar up the file:
% mkdir handin % cp *.[ch] handin/. % cp README handin/. % tar cvf hw10.tar handinIf you forget to list the tar file target (hw10.tar) in the tar command, tar will exit with an error message.
% ls README btree.c btree.h main.c % tar cvf hw10.tar main.c btree.c btree.h README % ls README btree.c btree.h hw10.tar main.c
In this example, the btree.h, btree.c, main.c and README files are combined into a single tarfile named hw10.tar
WARNING: be sure to include the destination tarfile name argument to tar (in this example it is the hw10.tar argument), otherwise tar will overwrite the contents of one of the source file arguments with the tarfile. In fact, before you create a tarfile, it is a good idea to create copies of these files in another directory (and better yet, just use the first option and tar up this directory of copies instead).
% mkdir handin % cp *.[ch] handin/.
% tar xvf hw10.tar handin/ handin/README handin/btree.c handin/btree.h handin/main.c
% tar tf hw10.tar handin/ handin/README handin/btree.c handin/btree.h handin/main.cFor more information look at the man page for tar: % man tar