Suppose you have a bunch of files and/or directories and want to email them or transport them on a floppy disk. You obviously want to waste as little space as possible and to save the directory structure along with the files. To do this you need to create a tar (tape archive) file. This old command can be used to put directories and files onto magnetic tape---hence the name.
Let's say that the files you want to send are in your home directory under the directory named Lab01. You want to create a tar file of Lab01 and all files and subdirectories that it contains.
Here's what you do:
cd ~
tar zcf foo.tgz Lab01. You can send this
archive, put it on a floppy etc. Under Windows use Winzip to extract
the contents of the file.
tar ztf foo.tgz to see a list.
tar zxf
foo.tgz. Warning!: uncompressing the
archive will overwrite any indentically named files and
directories. You can create a separate directory named tmp
(mkdir tmp and uncompress/untar the archive to the
directory via tar zxf foo.tgz -C tmp.