Hosting Operations
Read-onlyFind Missing Files in an Old Backup
You need to compare a backup archive against a required file list and print required files that are absent.
Command
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" -
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not use it as checksum validation; it only checks required path presence.
Expected output
Required paths missing from the older backup, such as app/orders.csv and uploads/avatar.txt.
System impact
Read-only. Nothing changes. The command compares sorted file lists.
Recovery / rollback: no state is changed.
When to use it
Use during restore drills to catch incomplete backups before relying on them.
When not to use it
Do not use it as checksum validation; it only checks required path presence.
next steps
Related commands
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" -
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
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}'
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"
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.