>From the info tar command: File: tar.info, Node: extracting files, Next: extract dir, Prev: extracting archives, Up: extract Extracting Specific Files ------------------------- To extract specific archive members, give their exact member names as arguments, as printed by `--list' (`-t'). If you had mistakenly deleted one of the files you had placed in the archive `collection.tar' earlier (say, `blues'), you can extract it from the archive without changing the archive's structure. It will be identical to the original file `blues' that you deleted. First, make sure you are in the `practice' directory, and list the files in the directory. Now, delete the file, `blues', and list the files in the directory again. You can now extract the member `blues' from the archive file `collection.tar' like this: $ tar --extract --file=collection.tar blues If you list the files in the directory again, you will see that the file `blues' has been restored, with its original permissions, creation times, and owner. (These parameters will be identical to those which the file had when you originally placed it in the archive; any changes you may have made before deleting the file from the file system, however, will _not_ have been made to the archive member.) The archive file, `collection.tar', is the same as it was before you extracted `blues'. You can confirm this by running `tar' with `--list' (`-t'). Remember that as with other operations, specifying the exact member name is important. `tar --extract --file=bfiles.tar birds' will fail, because there is no member named `birds'. To extract the member named `./birds', you must specify `tar --extract --file=bfiles.tar ./birds'. To find the exact member names of the members of an archive, use `--list' (`-t') (*note list::). You can extract a file to standard output by combining the above options with the `--to-stdout' option (*note Writing to Standard Output::). If you give the `--verbose' (`-v') option, then `--extract' (`--get', `-x') will print the names of the archive members as it extracts them. On Mon, 2002-11-04 at 23:34, Alan Dayley wrote: > Before I wiped my partition and installed Red Hat Linux 8.0, I backed up > my home directory to with tar. Now that I have things moving and am > staying with 8.0, I want to restore some of the files from my backup. > > I was using GPG and had generated keys for myself. I don't know what > file the keys and/or keyrings are in inside the tar backup. And, as an > aside, I am not sure of the tar command syntax to extract specific files > from the tar file. I don't want to just extract it all, only the files > that I need. Any hints? > > Alan > > > > > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us > To subscribe, unsubscribe, or to change you mail settings: > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss -- David IS Mandala gpg fingerprint 8932 E7EF CCF5 1B8C 1B5C A92E C678 795E 45B2 D952 Phoenix, AZ (480) 460-7546 HP, (602) 321-8277 CP http://www.them.com/~davidm/