nerdexam
LPI

010-100 · Question #15

Which approach will provide a listing of the contents in a tar archive?

The correct answer is A. Use the tar command with -t. The tar command has a built-in option to list archive contents without extracting them. The -t flag (table of contents) performs this listing.

The Power of the Command Line

Question

Which approach will provide a listing of the contents in a tar archive?

Options

  • AUse the tar command with -t.
  • BUse the grep command.
  • CUse the find command.
  • DUse the zless command.
  • EUse the zlist command.

How the community answered

(34 responses)
  • A
    79% (27)
  • B
    3% (1)
  • C
    12% (4)
  • D
    6% (2)

Why each option

The tar command has a built-in option to list archive contents without extracting them. The -t flag (table of contents) performs this listing.

AUse the tar command with -t.Correct

Running tar with the -t option (often combined with -f to specify the archive file, e.g., tar -tf archive.tar) reads the archive and prints each stored file path to standard output without extracting any data. This is the standard, correct method for inspecting tar archive contents.

BUse the grep command.

The grep command searches text patterns within files or streams and cannot parse or list the internal structure of a tar archive.

CUse the find command.

The find command searches the live filesystem for files matching criteria and has no ability to inspect the contents of a tar archive.

DUse the zless command.

The zless command is used to page through gzip-compressed text files and cannot list the file entries inside a tar archive.

EUse the zlist command.

There is no standard Linux command called zlist; this is not a valid utility.

Concept tested: Listing contents of a tar archive with -t

Source: https://man7.org/linux/man-pages/man1/tar.1.html

Topics

#tar command#archive listing#tar options#file compression

Community Discussion

No community discussion yet for this question.

Full 010-100 Practice