Back to commands

Hosting Operations

Read-only, can be slow

Compare Source and Backup File Lists

You need to compare relative file paths in source and backup directories.

Command

comm -3 <(find source -type f | sed 's#^source/##' | sort) <(find backup -type f | sed 's#^backup/##' | sort)

Before you run this

System impact: Read-only. Can create load on large logs, directories, filesystems, or process tables.

When not to use it: Do not use it to prove files have identical contents; compare checksums or use rsync itemization too.

Expected output

Paths present only on one side of the comparison.

System impact

Read-only, can be slow. Nothing changes. The command compares sorted relative file lists.

Scope this to the smallest useful path or service on busy systems.

Recovery / rollback: no state is changed.

When to use it

Use when checking whether a backup contains the same files as the source tree.

When not to use it

Do not use it to prove files have identical contents; compare checksums or use rsync itemization too.

next steps

Related commands

Hosting Operations Deletes data

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" -
Hosting Operations Can be slow

Find Files Newer Than a Backup Snapshot

Files newer than the last snapshot are the ones most likely missing from it.

find source -type f -newer backup/.snapshot -print | sort
Hosting Operations Read-only

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" -
Hosting Operations Can be slow

List Newest Source Files Before Backup

Before trusting a backup, know which files changed most recently.

find source -type f -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort
Hosting Operations Can be slow

Find System Cron Files Fast

A job can be nowhere in your crontab and still run every night.

find /etc/cron.d /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly -maxdepth 1 -type f -print 2>/dev/null | sort
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.

  • LPIC-1 style command-line practice
  • LFCS style performance-task practice
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.