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.

Watch this command run

Command transcript

This sanitized transcript shows the commands and output shape without exposing host details.

demo@lab:~$

$ find source backup -type f | sort

backup/.snapshot
backup/app/config.yml
backup/content/index.md
backup/old-report.csv
backup/tmp/empty.cache
source/app/config.yml
source/assets/logo.svg
source/content/about.md
source/content/index.md

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

	.snapshot
assets/logo.svg
content/about.md
	old-report.csv
	tmp/empty.cache
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

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

next steps

Related commands

Hosting Operations Deletes data

Check Required Files After Restore

A successful extraction still needs a required-file check.

cd restore-dr && rm -rf restore-sandbox/full && mkdir -p restore-sandbox/full && tar -xf backups/2026-06-25/site.tar -C restore-sandbox/full && find restore-sandbox/full -type f | sed 's#^restore-sandbox/full/##' | sort | comm -23 required-files.txt -
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.

cd restore-dr && tar -tf backups/2026-06-24/site.tar | sed 's#^./##' | sort | comm -23 required-files.txt -
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

List Largest Files in a Backup

Large backup files are where storage surprises usually start.

find backup -type f -printf '%s %p\n' | sort -nr | head
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.

  • lpic1:103-gnu-unix-commands
  • lpic1:104-filesystems-permissions-fhs
  • lfcs:essential-commands
  • lfcs:operations-deployment
  • lfcs:services-logs
  • lfcs:storage
  • linuxplus:automation-scripting
  • linuxplus:provisional
  • linuxplus:system-management
  • risk:read-only

Useful for

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

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