>_ IzzyLab

Hands-on task

This task is step 3 of the course “find and xargs: search and bulk operations”

find: all hidden files in the project

easy~3 min

Before publishing the shared folder /srv/projects, you need to check which hidden files (the name starts with a dot) it contains at any depth. Write the full paths of all hidden files — files only, not directories — to /root/hidden.txt, one per line, in any order.

What you'll practise:
  • find
  • -name
  • -type f
  • hidden files
  • dotfiles

Topic breakdown

In Unix "hidden" is not a file attribute but a convention: names starting with a dot are not shown by ls or by shell * globs by default. To find such files across the whole tree, use a recursive find with two filters: by object type (-type f — regular files only, no directories) and by name pattern. -name matches the pattern only against the last path component, so a regular file inside a hidden directory (.cache/build.log) won't show up, and the .cache directory itself is dropped by the type filter. A pattern with metacharacters is quoted so the shell doesn't expand it before find even starts.

What's checked

  1. file /root/hidden.txt created
  2. all hidden files listed, and only them

What it looks like