Test Files That Will Be Untarred and Uncompressed


-zvtf

Before you take apart a tarball (whether or not it was also compressed using gzip), it's a really good idea to test it. First, you'll know if the tarball is corrupted, saving yourself hair pulling when files don't seem to work. Second, you'll know if the person who created the tarball thoughtfully tarred up a directory containing 100 files, or instead thoughtlessly tarred up 100 individual files, which you're just about to spew all over your desktop.

To test your tarball (once again assuming it was also zipped using gzip), use the -t (or --list) option.

$ tar -zvtf moby.tar.gz scott/scott 0 moby-dick/ scott/scott 102519 moby-dick/job.txt scott/scott 0 moby-dick/bible/ scott/scott 207254 moby-dick/bible/genesis.txt scott/scott 102519 moby-dick/bible/job.txt scott/scott 1236574 moby-dick/moby-dick.txt scott/scott 508925 moby-dick/paradise_lost.txt 


This tells you the permissions, ownership, file size, and time for each file. In addition, because every line begins with moby-dick/, you can see that you're going to end up with a directory that contains within it all the files and subdirectories that accompany the tarball, which is a relief.

Be sure that the -f is the last option because after that you're going to specify the name of the .tar.gz file. If you don't, tar complains:

$ tar -zvft moby.tar.gz tar: You must specify one of the `-Acdtrux'  options Try `tar --help' or `tar --usage'  for more information. 


Now that you've ensured that your .tar.gz file isn't corrupted, it's time to actually open it up, as you'll see in the following section.

Note

If you're testing a tarball that was compressed using bzip2, just use this command instead:

$ tar -jvtf moby.tar.bz2 





Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net