Examples:-
tar cf mytar.tar mydirectory/
Create the tar file ``mytar.tar'' holding the entire directory subtree supported by the directory ``mydirectory/''.
tar xvf mytar.tar
Extract (unpack) the tar file ``mytar.tar'' into the current directory with verbose printout.
tar cf - mydirectory/ | gzip -c > mytar.tar.gz
gunzip -c mytar.tar.gz | tar xf -
Examples piping tar and gzip together to either create a compressed tar file or unpack a compressed tar file. The Linux version of tar can do this using the -z option e.g.:-
tar zcf mytar.tar.gz
tar zxf mytar.tar.gz