*************************************************************************** * The Unix tar function combines files and puts them into one file. It does * not compress files so it makes no sense to tar one file. Typically we tar * all the files in a particular directory. We use the gzip utility to * compress files. If you see a file like filename.tar.gz it contains a number * of files that have been tarred together and then compressed. *************************************************************************** To create a tar file: cd to parent of directory to be tarred. Type: tar -cvpf your_filename.tar directory_name This results in: your_filename.tar a) use r instead of c to replace (append) b) use u instead of c to replace (update) c) NB: Use a relative file reference for directory! This allows easy move of file tree To create a compressed version of this tar file: Type: gzip your_filename.tar. Result will be your_filename.tar.gz To uncompress your your_filename.tar.gz type: gzip -d your_filename.tar.gz. This results in: your_filename.tar To extract (untar) the individual files type: tar -xvpf your_filename.tar a) tar -tvf your_filename.tar to just list the files. Note 1: The purpose of compressing files is to save space so once a directory has been tarred and compressed we would typically delete that directory and all the files in it. The command would be /usr/bin/rm -r directory_name. Be careful when deleting files. Note 2: compress and compress -d is a substitute for gzip -9 and gzip -d.