A tar is an archive file (
.tar) that allows to store collection of files and directories. A tar archive file can be compressed using various algorithms such as gzip. By convention, when a tar archive file is compressed with gzip,
.tgz extension is used. This tutorial shows how to view content of tar gz file without extracting in Linux.
tar command can be used for viewing content of tar archive files without extracting it. A syntax to view content of
tar tf filename.tar.gz
- before the options (
tf) is optional for
tar command. Compression algorithm is automatically detected. Used options:
t- specifies to view content of archive file.
f- specifies filename of archive file.
For example, the following command allows to view content of
backup.tar.gz file without extracting it:
tar tf backup.tar.gz