List the contents of backup.tar.gz without extracting it. (Use tar -tzf command)
List the Contents of backup.tar.gz Without Extracting
Use the following command:
bashCopyEdittar -tzf backup.tar.gz
Explanation of Options:
t→ List the contents of the archivez→ Handle gzip (.gzcompressed file)f→ Specify the archive file
Expected Output Example:
bashCopyEditbackup_dir/
backup_dir/file1.txt
backup_dir/file2.txt
This confirms that backup.tar.gz contains backup_dir and its files.