======================================= ACADUNIX tar commands (GNU and not-GNU) ======================================= -IAN! idallen@ncf.ca ACADUNIX has two versions of the "tar" command available. The one you get by default is the standard old IBM version that doesn't understand how to decompress gzip-compressed tar archives. You have to use some other program (e.g. gunzip) to decompress the archive before IBM tar will unpack it (ref: Chapter 3). IBM tar also has a "feature" in that if the tar archive contains a protected directory (no write permissions) containing files, when you unpack the archive, this "tar" command creates the directory first, with insufficient permissions to later create the files inside the directory! You see a lot of "permission denied" errors as the IBM tar tries to create files inside a directory without write permissions. You can work around this "feature" of IBM tar by adding write permission to the directory yourself, and then re-running tar to extract the files in the directory. (You may have to repeat this many times if there are many sub-sub-directories that also need write permission added.) I had ITS put a copy of the open-source GNU tar on ACADUNIX under the /usr/local/bin/ directory. When you type "/usr/local/bin/tar", you get this GNU program instead of the stock IBM program. (This is the program you used for Exercise #3.) The GNU tar does not remove the write permissions from the directory until *after* it has put all the files in it; so, you don't see any errors when you unpack an archive containing protected directories. GNU tar also understands the "z" option to tar that will decompress compressed archives for you without requiring gunzip. You can use either program; your choice. Be aware of the "features" of the IBM program, if you use it. Summary: GNU tar: To extract files from a compressed GNU tar archive on a machine that has the GNU tar program installed (a tar program that understands gzip compressed tar archives): $ tar -xzf foo.tar.gz The "z" option tells GNU tar to decompress the archive before trying to extract the files inside it. You can add "v" to the option list to get a verbose listing of the files being extracted. Non-GNU tar (e.g. stock IBM AIX): To extract files from a compressed GNU tar archive using a version of tar that does not understand the gzip compressed format, you must decompress the archive file first: $ gunzip foo.tar.gz $ tar -xf foo.tar You can add "v" to the option list to get a verbose listing of the files being extracted. Note that your Linux textbook shows the use of "zcat" to decompress a tar archive and feed it to a tar program on standard input (p.49): $ zcat xgrabsc.tgz | tar xvf - (The pathname "-" tells the tar program to read from standard input.) The above line only works if "zcat" knows how to decompress a gzip file. The stock IBM AIX version of "zcat" does not know how to do this! The IBM version of "zcat" only knows how to decompress "compress" format compressed files (files that often end in ".Z", not ".gz"). To extract a GNU tar archive on IBM AIX, either use a GNU tar program or use gunzip to decompress the file before you use the stock IBM AIX tar program. (I recommend usint GNU tar - it handles archives containing protected directories better.)