nerdexam
CompTIA

XK0-005 · Question #778

A systems administrator needs to list the contents of archive.tar.xz. Which of the following commands will list the files?

The correct answer is B. tar tJf archive.tar.xz. To list the contents of an archive.tar.xz file, the tar command should be used with options to list contents and specify the xz compression format.

System Management

Question

A systems administrator needs to list the contents of archive.tar.xz. Which of the following commands will list the files?

Options

  • Atar ddf archive.tar.xz
  • Btar tJf archive.tar.xz
  • Ctar xzf archive.tar.xz
  • Dtar jvf archive.tar.xz

How the community answered

(30 responses)
  • A
    3% (1)
  • B
    93% (28)
  • C
    3% (1)

Why each option

To list the contents of an `archive.tar.xz` file, the `tar` command should be used with options to list contents and specify the xz compression format.

Atar ddf archive.tar.xz

The `d` option with `tar` is used to find differences between an archive and the filesystem, not to list the archive's contents, and `ddf` is not a standard option combination for listing.

Btar tJf archive.tar.xzCorrect

The `tar tJf archive.tar.xz` command uses 't' to list the contents of the archive and 'J' to specify that the archive is compressed with xz, which corresponds to the `.xz` file extension. The 'f' option is used to specify the archive file name.

Ctar xzf archive.tar.xz

The `x` option is used to extract files from the archive, not merely to list them, and the `z` option is for gzip compression, which is incorrect for an `xz` archive.

Dtar jvf archive.tar.xz

The `j` option is used for bzip2 compression, which is incompatible with an `xz` compressed archive, and thus this command would fail to correctly process the file.

Concept tested: Listing tar.xz archive contents

Source: https://www.gnu.org/software/tar/manual/html_node/tar-Options.html

Topics

#tar command#file compression#archive management#command line utilities

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice