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.tgzwould attempt to re-compress an already compressed file or incorrectly handle the pipe, andxvf -would extract, not just list, if it even received input. - C.
gzip -d archive.tgzwithout-cdecompresses to a file namedarchive.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.tgzis 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)
Topics
#tar#gzip#Archiving#File Management
Community Discussion
No community discussion yet for this question.