Hosting Operations
Read-only, can be slowFind Empty Files in a Backup
You need to spot empty files inside a backup tree.
Command
find backup -type f -size 0 -print
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 assume every empty file is bad; lock files and placeholders can be intentional.
Expected output
Paths to empty files in the backup directory.
System impact
Read-only, can be slow. Nothing changes. The command prints zero-byte regular files.
Scope this to the smallest useful path or service on busy systems.
Recovery / rollback: no state is changed.
When to use it
Use after backup jobs, exports, or uploads where empty files may indicate failed writes.
When not to use it
Do not assume every empty file is bad; lock files and placeholders can be intentional.
Explanation-only example
Illustrated output, not a live lab run
This example is intentionally illustrative. It shows the command shape without killing real processes or changing your machine.
$ find backup -type f -printf '%s %p\n' | sort -n
0 backup/.snapshot
0 backup/tmp/empty.cache
13 backup/old-report.csv
26 backup/content/index.md
39 backup/app/config.yml
$ find backup -type f -size 0 -print
backup/tmp/empty.cache
backup/.snapshot
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
find backup -type f -printf '%s %p\n' | sort -nfind backup -type f -size 0 -print
next steps
Related commands
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
List Empty Directories as Cleanup Candidates
Empty directories are low-risk candidates, but they still deserve a preview.
find /lab/disk-inode-cleanup/var/cache/app -xdev -depth -type d -empty -print
Compare Source and Backup File Lists
A backup can be missing files and still look plausible at a glance.
comm -3 <(find source -type f | sed 's#^source/##' | sort) <(find backup -type f | sed 's#^backup/##' | sort)
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
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.
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.