Go to the previous, next section.

How to List Archives

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

Use `--list' (`-t') to print the names of members stored in an archive. Use a `--file=archive-name' (`-f archive-name') option just as with `--create' (`-c') to specify the name of the archive. For example, the archive `afiles.tar' created in the last section could be examined with the command `tar --list --file=afiles.tar'. The output of tar would then be:

apple
angst
asparagus

The archive `bfiles.tar' would list as follows:

./baloons
baboon
./bodacious

(Of course, `tar --list --file=empty-archive.tar' would produce no output.)

If you use the `--verbose' (`-v') option with `--list' (`-t'), then tar will print out a listing reminiscent of `ls -l', showing owner, file size, and so forth.

You can also specify member names when using `--list' (`-t'). In this case, tar will only list the names of members you identify. For example, `tar --list --file=afiles.tar apple' would only print `apple'. It is essential when specifying member names to tar that you give the exact member names. For example, `tar --list --file=bfiles baloons' would produce no output, because there is no member named `baloons', only one named `./baloons'. While the file names `baloons' and `./baloons' name the same file, member names are compared using a simplistic name comparison, in which an exact match is necessary.

Go to the previous, next section.