Linux Survival Basics
Read-onlyList Contents of a Backup Tarball
You need to see what a backup tarball contains before restoring it.
Command
tar -tf archives/site-backup.tar | sort | head
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not treat a file listing as content verification; pair it with checksums when possible.
Expected output
A sorted sample of paths stored inside the tar archive.
System impact
Read-only. Nothing changes. The command lists archive member names.
Recovery / rollback: no state is changed.
When to use it
Use before extracting a backup archive or when checking whether expected files are present.
When not to use it
Do not treat a file listing as content verification; pair it with checksums when possible.
next steps
Related commands
List Archive Contents Before Extracting
You can inspect a tar backup before it writes a single file.
BACKUP_ROOT=/srv/backups/site && tar -tf "$BACKUP_ROOT/2026-06-25/site.tar" | sed 's#^./##' | sort
Count Failures by Test File
Turn noisy test logs into a ranked failure list.
grep -RhoE '[A-Za-z0-9_./-]+\.(test|spec)\.(js|ts|py|rb)' logs/ | sort | uniq -c | sort -nr | head
Find the Largest Installed Packages
Disk cleanup starts with evidence, not random package removal.
dpkg-query -W -f='${Installed-Size}\t${Package}\n' | sort -nr | head -20
Find the Files Eating Your Disk
The disk was full, but guessing at folders was the slow part.
find /var -type f -printf '%s %p\n' | sort -nr | head -20
Show Big Files in Human Units
Byte counts are precise. Human units are faster under pressure.
find /var -type f -printf '%s %p\n' | sort -nr | head -10 | awk '{printf "%.1f MB %s\n", $1/1024/1024, $2}'
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.