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

A.

gzip archive.tgz | tar xvf -

B.

tar ztf archive.tgz

C.

gzip -d archive.tgz | tar tvf -

D.

tar cf archive.tgz

题解

「gzip」指令可以压缩/解压缩文件成为 gz 格式。「tar」指令可以用来封装(压缩)文件,或是解除封装(压缩)。

选项 A,错误的用法。

选项 B,由于「t」参数的关系,会列出「archive.tgz」压缩封装中的文件名称。

选项 C,错误的用法。

选项 D,错误的用法。