101-500 Exam QuestionsBrowse all questions from this exam

101-500 Exam - Question 56


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

Show Answer
Correct Answer: E

The command 'tar ztf archive.tgz' is used to display the contents of a gzip compressed tar archive. The 'z' option specifies that the archive is compressed with gzip, the 't' option lists the contents of the archive, and the 'f' option indicates that the archive file name will follow. Thus, this command properly utilizes all necessary options to display the contents of the specified gzip compressed tar archive.

Discussion

8 comments
Sign in to comment
klomOption: B
Sep 5, 2020

the correct one is: tar -ztf archive.tar.gz

germanb
Sep 8, 2020

this is correct

CuriousLinuxCat
Jul 24, 2021

Agreed, this is the correct format. -z Use Gzip -t List contents -f Specify file or else will use $TAPE.

PERjhamOption: E
Jan 7, 2021

"tar zvf" is the correct, command tar work without the "-" character too (testing in rhel and same, and debian).

SScott
Nov 26, 2021

That is correct, this option will work without switches and can be .tar.gz or tgz (Tested using CentOS7): tar cvfz backup-1.tgz (to create) tar ztf backup-1.tgz (to list the contents without extracting/unpacking) the tar.gz can be substituted just fine with .tgz z switch is for handling .tar.gz g zip files, the t switch list the contents without extracting the file, and f specifies the command is to use the archive file name, the -v switch would help to show permissions, size, and timestamp but the answer E could exclude this as the question asks about displaying the contents of the tar file. https://www.hostdime.com/kb/hd/command-line/how-to-tar-untar-and-zip-files

MartiFC
Nov 25, 2021

correct

demarkoOption: E
Dec 20, 2020

non of these option worked on centos7 tar -tvf is the answer https://www.tecmint.com/18-tar-command-examples-in-linux/

blk_542
Nov 18, 2022

Tested them all, none worked in CentOS 7

dawith
Sep 8, 2023

correct

Tewodros89Option: B
Sep 15, 2023

the correct one is: tar -ztf archive.tar.gz

NinymoOption: E
Mar 24, 2024

Answer: E