Linux Foundation Certified System Administrator (LFCS) — Question 84
Which of the following commands displays the contents of a gzip compressed tar archive?
Answer options
- A. gzip archive.tgz | tar xvf -
- B. tar ztf archive.tgz
- C. gzip -d archive.tgz | tar tvf -
- D. tar cf archive.tgz
Correct answer: B
Explanation
The correct answer, B, utilizes the 'tar' command with the 'z' option to handle gzip compression and 't' to display the contents without extracting them. Options A and C attempt to extract or display files incorrectly, while D is for creating an archive instead of listing the contents.