Hosting Operations
Read-onlyList Archive Contents Before Extracting
You need to see what an archive contains before extracting it into a restore sandbox.
Command
BACKUP_ROOT=/srv/backups/site && tar -tf "$BACKUP_ROOT/2026-06-25/site.tar" | sed 's#^./##' | sort
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 byte-level integrity validation.
Expected output
Sorted archive paths such as app/config.yml, public/index.html, and uploads/avatar.txt.
System impact
Read-only. Nothing changes. The tar table of contents is read from the archive.
Recovery / rollback: no state is changed.
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.
next steps
Related commands
Find Missing Files in an Old Backup
The fastest failed restore drill is the one that finds missing critical files early.
BACKUP_ROOT=/srv/backups/site REQUIRED=/srv/backups/site/required-files.txt && tar -tf "$BACKUP_ROOT/2026-06-24/site.tar" | sed 's#^./##' | sort | comm -23 "$REQUIRED" -
Check Required Files After Restore
A successful extraction still needs a required-file check.
BACKUP_ROOT=/srv/backups/site REQUIRED=/srv/backups/site/required-files.txt RESTORE_SANDBOX=/tmp/linuxoneliners-restore/full && rm -rf "$RESTORE_SANDBOX" && mkdir -p "$RESTORE_SANDBOX" && tar -xf "$BACKUP_ROOT/2026-06-25/site.tar" -C "$RESTORE_SANDBOX" && find "$RESTORE_SANDBOX" -type f | sed "s#^$RESTORE_SANDBOX/##" | sort | comm -23 "$REQUIRED" -
Diff Restored Config Against Expected
A restored config can exist and still be the wrong config.
BACKUP_ROOT=/srv/backups/site EXPECTED_CONFIG=/srv/backups/site/expected/app/config.yml RESTORE_SANDBOX=/tmp/linuxoneliners-restore/full && rm -rf "$RESTORE_SANDBOX" && mkdir -p "$RESTORE_SANDBOX" && tar -xf "$BACKUP_ROOT/2026-06-25/site.tar" -C "$RESTORE_SANDBOX" && diff -u "$EXPECTED_CONFIG" "$RESTORE_SANDBOX/app/config.yml"
Review Critical File Modes in the Archive
Permissions are part of the restore, not decoration.
BACKUP_ROOT=/srv/backups/site && tar -tvf "$BACKUP_ROOT/2026-06-25/site.tar" | awk '/secrets.env|deploy.sh/ {print $1, $6}'
Extract a Backup Into a Restore Sandbox
A restore drill should write to a sandbox, not production.
BACKUP_ROOT=/srv/backups/site RESTORE_SANDBOX=/tmp/linuxoneliners-restore/full && rm -rf "$RESTORE_SANDBOX" && mkdir -p "$RESTORE_SANDBOX" && tar -xf "$BACKUP_ROOT/2026-06-25/site.tar" -C "$RESTORE_SANDBOX"
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.