View Content of Tar Gz File Without Extracting in Linux

View Content of Tar Gz File Without Extracting in Linux

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, .tar.gz or .tgz extension is used. This tutorial shows how to view content of tar gz file without extracting in Linux.

The tar command can be used for viewing content of tar archive files without extracting it. A syntax to view content of .tar.gz file:

tar tf filename.tar.gz

Adding - 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

Leave a Comment

Cancel reply

Your email address will not be published.