nerdexam
Linux_FoundationLinux_Foundation

LFCS · Question #801

LFCS Question #801: Real Exam Question with Answer & Explanation

The correct answer is B: tar ztf archive.tgz. To display the contents of a gzip compressed tar archive, use the tar command with the z (gzip), t (list), and f (file) options.

Submitted by akirajp· Apr 18, 2026Essential Commands

Question

Which of the following commands displays the contents of a gzip compressed tar archive?

Options

  • Agzip archive.tgz | tar xvf -
  • Btar ztf archive.tgz
  • Cgzip -d archive.tgz | tar tvf -
  • Dtar cf archive.tgz

Explanation

To display the contents of a gzip compressed tar archive, use the tar command with the z (gzip), t (list), and f (file) options.

Common mistakes.

  • A. gzip archive.tgz would attempt to re-compress an already compressed file or incorrectly handle the pipe, and xvf - would extract, not just list, if it even received input.
  • C. gzip -d archive.tgz without -c decompresses to a file named archive.tar (or similar) in the current directory and does not send output to stdout for piping; therefore, this command sequence is functionally incorrect for piping.
  • D. tar cf archive.tgz is used to create (c) a tar archive (f) from files, not to display the contents of an existing one.

Concept tested. tar command (gzip, list contents)

Reference. https://www.gnu.org/software/tar/manual/tar.html

Topics

#tar#gzip#Archiving#File Management

Community Discussion

No community discussion yet for this question.

Full LFCS PracticeBrowse All LFCS Questions