Back to lessons

Hosting Operations

List Archive Contents Before Extracting

You need to see what an archive contains before extracting it into a restore sandbox.

Command

cd restore-dr && tar -tf backups/2026-06-25/site.tar | sed 's#^./##' | sort

What changed

Nothing changes. The tar table of contents is read from the archive.

Danger

safe

When to use it

Use before restore drills, migrations, or incident restores to confirm the archive shape.

When not to use it

Do not treat a file listing as byte-level integrity validation.

Undo or recovery

No undo needed because this command is read-only.

Expected output

Sorted archive paths such as app/config.yml, public/index.html, and uploads/avatar.txt.

demo script

Disposable terminal steps

  1. cd restore-dr && tar -tf backups/2026-06-25/site.tar | sort
  2. cd restore-dr && tar -tf backups/2026-06-25/site.tar | sed 's#^./##' | sort | sed -n '1,12p'

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ cd restore-dr && tar -tf backups/2026-06-25/site.tar | sort
./
./CHECKSUMS.sha256
./app/
./app/config.yml
./app/orders.csv
./app/secrets.env
./bin/
./bin/deploy.sh
./public/
./public/index.html
./uploads/
./uploads/avatar.txt
::exit-code::0
$ cd restore-dr && tar -tf backups/2026-06-25/site.tar | sed 's#^./##' | sort | sed -n '1,12p'

CHECKSUMS.sha256
app/
app/config.yml
app/orders.csv
app/secrets.env
bin/
bin/deploy.sh
public/
public/index.html
uploads/
uploads/avatar.txt
::exit-code::0

YouTube Short

List before extract.

Tar can show the archive contents before you extract anything. Use that before a restore drill touches a sandbox.

LinkedIn hook

You can inspect a tar backup before it writes a single file.

Question: Do you list archive contents before restore tests?

experiments

A/B tests to run

Metric: watch_time

A: List before extract.

B: Know what the tarball will write.