[tar] List the files in an archive without extracting them

Created on November 30, 2026

Use tar -tf to list the members of a tar archive. This example lists a gzip-compressed archive containing two files.

tar -tf archive.tar.gz
file1.txt
dir/file2.txt

-t lists entries and -f specifies the archive. GNU tar detects compression when reading a regular archive file. You can also pass -z to specify gzip explicitly.

Add -v to include details such as permissions, size, and modification time.

tar -tvf archive.tar.gz

Reference

Shell command tar