Re: Extracting individual Files via tar
My thanks to 3 people who pointed out the error of my ways. I actually had the positions of the archive and the file I was extracting reversed as far as what I was thinking should be the correct order. Then, I thought maybe I didn't need to have the f flag. Anyway, it all works fine now. Many thanks. Martin McCormick "Rob" writes: >You should always use the f option to specify the archive - for example > >tar -tzf archive.tgz > >to list or > >tar -xzf archive.tgz > >to extract. In your example below, you didn't specify an archive so it >defaulted to the device /dev/sa0, which it couldn't open. > >Any extra arguments are treated as archive members - eg > >tar -xzf archive.tgz files/to/extract > >In your example below, it was trying to find 2 files in a non-existent >archive. > >----- Original Message ----- >From: "Martin McCormick" <[EMAIL PROTECTED]> >Subject: Extracting individual Files via tar > > >> The command >> >> tar ztf /usr/local/src/ports.tar.gz >> >> produces a table of contents just like the man page says it should. >> The man page also says that individual files can be recovered or >> listed but I haven't gotten that to work at all. if I try: >> >> $ tar zt ports/print/pstotext/ /usr/local/src/ports.tar.gz >> >> tar (child): /dev/sa0: Cannot open: Permission denied >> tar (child): Error is not recoverable: exiting now >> >> gzip: stdin: unexpected end of file >> tar: Child returned status 2 >> tar: ports/print/pstotext: Not found in archive >> tar: /usr/local/src/ports.tar.gz: Not found in archive >> tar: Error exit delayed from previous errors >> >> In the successful test, tar obviously knew which specification >> was the archive and was able to uncompress it with the z flag. The >> file specification I am attempting to recover from the archive throws >> tar completely off. I looked in the handbook and all the examples I >> found were the more usual procedure of unpacking whole file systems >> as in >> >> tar zxf somedir/archive.tar.gz >> >> I'm not having trouble with that use of tar. >> >> Thank you. >> >> Martin McCormick WB5AGZ Stillwater, OK >> OSU Information Technology Division Network Operations Group >> ___ >> [EMAIL PROTECTED] mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >> To unsubscribe, send any mail to >"[EMAIL PROTECTED]" >> > ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Extracting individual Files via tar
you must use the f flag when manipulation files. no f flag equals attempt to access tape drive. Martin McCormick wrote: The command tar ztf /usr/local/src/ports.tar.gz produces a table of contents just like the man page says it should. The man page also says that individual files can be recovered or listed but I haven't gotten that to work at all. if I try: $ tar zt ports/print/pstotext/ /usr/local/src/ports.tar.gz tar (child): /dev/sa0: Cannot open: Permission denied tar (child): Error is not recoverable: exiting now gzip: stdin: unexpected end of file tar: Child returned status 2 tar: ports/print/pstotext: Not found in archive tar: /usr/local/src/ports.tar.gz: Not found in archive tar: Error exit delayed from previous errors In the successful test, tar obviously knew which specification was the archive and was able to uncompress it with the z flag. The file specification I am attempting to recover from the archive throws tar completely off. I looked in the handbook and all the examples I found were the more usual procedure of unpacking whole file systems as in tar zxf somedir/archive.tar.gz I'm not having trouble with that use of tar. Thank you. Martin McCormick WB5AGZ Stillwater, OK OSU Information Technology Division Network Operations Group ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Extracting individual Files via tar
in message <[EMAIL PROTECTED]>, wrote Martin McCormick thusly... > > The command > > tar ztf /usr/local/src/ports.tar.gz > > produces a table of contents just like the man page says it should. > The man page also says that individual files can be recovered or > listed but I haven't gotten that to work at all. if I try: > > $ tar zt ports/print/pstotext/ /usr/local/src/ports.tar.gz > > tar (child): /dev/sa0: Cannot open: Permission denied > tar (child): Error is not recoverable: exiting now You forgot the bit about default file... -f [hostname:]file --file [hostname:]file Read or write the specified file (default is /dev/sa0). If a hostname is specified, tar will use rmt(8) to read or write the specified file on a remote machine. ``-'' may be used as a file- name, for reading or writing to/from stdin/stdout. ...try this instead... tar zxf /usr/local/src/ports.tar.gz ports/print/pstotext/ - Parv -- ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Extracting individual Files via tar
You should always use the f option to specify the archive - for example tar -tzf archive.tgz to list or tar -xzf archive.tgz to extract. In your example below, you didn't specify an archive so it defaulted to the device /dev/sa0, which it couldn't open. Any extra arguments are treated as archive members - eg tar -xzf archive.tgz files/to/extract In your example below, it was trying to find 2 files in a non-existent archive. - Original Message - From: "Martin McCormick" <[EMAIL PROTECTED]> Subject: Extracting individual Files via tar > The command > > tar ztf /usr/local/src/ports.tar.gz > > produces a table of contents just like the man page says it should. > The man page also says that individual files can be recovered or > listed but I haven't gotten that to work at all. if I try: > > $ tar zt ports/print/pstotext/ /usr/local/src/ports.tar.gz > > tar (child): /dev/sa0: Cannot open: Permission denied > tar (child): Error is not recoverable: exiting now > > gzip: stdin: unexpected end of file > tar: Child returned status 2 > tar: ports/print/pstotext: Not found in archive > tar: /usr/local/src/ports.tar.gz: Not found in archive > tar: Error exit delayed from previous errors > > In the successful test, tar obviously knew which specification > was the archive and was able to uncompress it with the z flag. The > file specification I am attempting to recover from the archive throws > tar completely off. I looked in the handbook and all the examples I > found were the more usual procedure of unpacking whole file systems > as in > > tar zxf somedir/archive.tar.gz > > I'm not having trouble with that use of tar. > > Thank you. > > Martin McCormick WB5AGZ Stillwater, OK > OSU Information Technology Division Network Operations Group > ___ > [EMAIL PROTECTED] mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "[EMAIL PROTECTED]" > ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Extracting individual Files via tar
The command tar ztf /usr/local/src/ports.tar.gz produces a table of contents just like the man page says it should. The man page also says that individual files can be recovered or listed but I haven't gotten that to work at all. if I try: $ tar zt ports/print/pstotext/ /usr/local/src/ports.tar.gz tar (child): /dev/sa0: Cannot open: Permission denied tar (child): Error is not recoverable: exiting now gzip: stdin: unexpected end of file tar: Child returned status 2 tar: ports/print/pstotext: Not found in archive tar: /usr/local/src/ports.tar.gz: Not found in archive tar: Error exit delayed from previous errors In the successful test, tar obviously knew which specification was the archive and was able to uncompress it with the z flag. The file specification I am attempting to recover from the archive throws tar completely off. I looked in the handbook and all the examples I found were the more usual procedure of unpacking whole file systems as in tar zxf somedir/archive.tar.gz I'm not having trouble with that use of tar. Thank you. Martin McCormick WB5AGZ Stillwater, OK OSU Information Technology Division Network Operations Group ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"