Linux Commands / IT Support Guides
List a tar archive before extracting it
Use tar to list the files in an archive before deciding whether to extract it.
Environment and inputs: Linux · Bash-compatible shell; package and service names vary by distribution
Understand the problem
Use a copy of the archive you can read. The example assumes the archive is named support-bundle.tar and is in the current directory.
Run the command
Run tar -tf support-bundle.tar. The -t option lists archive members and -f tells tar which archive to read.
tar -tf support-bundle.tar
Read the output
You might see logs/app.log and reports/summary.txt on separate lines. These names show where the archive stores its entries. A successful listing confirms you can read the list, while checking a restored file requires a separate test.
Choose the next step
Look for the expected paths. If tar reports an error, check the filename and the sender’s stated archive format. Review unexpected entries such as links or paths containing parent-directory components before extracting.
Before making changes
If you need to extract the archive, use a new empty directory under an ordinary account. Keep a copy of the original archive for comparison.