Go to the first, previous, next, last section, table of contents.


2.3 How to Extract Members from an Archive

(This message will disappear, once this node revised.)

In order to extract members from an archive, use the `--extract' (`-x') option. Specify the name of the archive with `--file=archive-name' (`-f archive-name'). To extract specific archive members, give their member names as arguments. It essential to give their exact member name, as printed by `--list' (`-t'). This will create a copy of the archive member, with a file name the same as its name in the archive.

Keeping the example of the two archives created at the beginning of this tutorial, `tar --extract --file=afiles.tar apple' would create a file `apple' in the current directory with the contents of the archive member `apple'. It would remove any file named `apple' already present in the directory, but it would not change the archive in any way.

Remember that specifying the exact member name is important. `tar --extract --file=bfiles.tar baloons' will fail, because there is no member named `baloons'. To extract the member named `./baloons' you would need to specify `tar --extract --file=bfiles.tar ./baloons'. To find the exact member names of the members of an archive, use `--list' (`-t').

FIXME: xref Listing Archives.

If you do not list any archive member names, then `--extract' (`-x') will extract all the members of the archive.

If you give the `--verbose' (`-v') option, then `--extract' (`-x') will print the names of the archive members as it extracts them.


Go to the first, previous, next, last section, table of contents.