Signal9Signal9 — home
online
back to labs

find: Hunt by Name, Size, Age — Then Act

MediumLinux Fundamentals15-20 min
The brief

A messy project tree lives at /root/hunt. Answer the first three questions with find — the real-time filesystem search that filters by any file property — searching ONLY under /root/hunt (not the whole disk). Save each answer by redirecting the command's output into the named file under /root/answers/ (the directory already exists) — for example: find /root/hunt … | sort > /root/answers/reports.txt

1. /root/answers/reports.txt — every match under /root/hunt whose name contains 'report' in ANY case (Report, REPORT…), full paths, sorted. (-iname is case-insensitive -name.)

2. /root/answers/big.txt — every file larger than 100 KiB, sorted. (-size, with k units.)

3. /root/answers/recent.txt — every file modified within the last day, sorted. (-mtime -1; the seed planted old files with old timestamps.)

4. Act on matches (no file to write): every *.sh script under /root/hunt must end up executable — in ONE find command using -exec.

find's superpower is combining WHERE (a subtree), WHAT (predicates), and ACTION (-exec) in one pass.

What you'll do
  • Collect case-insensitive 'report' name matches into reports.txt
  • Collect files >100 KiB into big.txt
  • Collect files modified in the last day into recent.txt
  • Make every .sh under /root/hunt executable via find -exec

Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.