Copyright (C) 2000-2012 |
GNU Info (tar.info)listHow to List Archives ==================== Frequently, you will find yourself wanting to determine exactly what a particular archive contains. You can use the `--list' (`-t') operation to get the member names as they currently appear in the archive, as well as various attributes of the files at the time they were archived. For example, you can examine the archive `collection.tar' that you created in the last section with the command, $ tar --list --file=collection.tar The output of `tar' would then be: blues folk jazz The archive `bfiles.tar' would list as follows: ./birds baboon ./box Be sure to use a `--file=ARCHIVE-NAME' (`-f ARCHIVE-NAME') option just as with `--create' (`-c') to specify the name of the archive. If you use the `--verbose' (`-v') option with `--list', then `tar' will print out a listing reminiscent of `ls -l', showing owner, file size, and so forth. If you had used `--verbose' (`-v') mode, the example above would look like: $ tar --list --verbose --file=collection.tar folk -rw-rw-rw- myself user 62 1990-05-23 10:55 folk You can specify one or more individual member names as arguments when using `list'. 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'. Because `tar' preserves paths, file names must be specified as they appear in the archive (ie., relative to the directory from which the archive was created). Therefore, it is essential when specifying member names to `tar' that you give the exact member names. For example, `tar --list --file=bfiles birds' would produce an error message something like `tar: birds: Not found in archive', because there is no member named `birds', only one named `./birds'. While the names `birds' and `./birds' name the same file, _member_ names are compared using a simplistic name comparison, in which an exact match is necessary. Note: absolute. However, `tar --list --file=collection.tar folk' would respond with `folk', because `folk' is in the archive file `collection.tar'. If you are not sure of the exact file name, try listing all the files in the archive and searching for the one you expect to find; remember that if you use `--list' with no file names as arguments, `tar' will print the names of all the members stored in the specified archive. automatically generated by info2www version 1.2.2.9 |