← Knowledge Base
LinuxReference note1 min read · updated 2026-11-27

Find files by name, size, age and owner with find

The find options I use most: name patterns, size, modification time, owner, and running a command on every match.

findfilescli

find walks a directory tree and tests every entry. The syntax is find <where> <tests> <action>.

find /var/log -name '*.log'                 # by name (quote the pattern)
find . -iname 'readme*'                     # case-insensitive
find /home -type f -size +100M              # files larger than 100 MiB
find . -type f -mtime -1                    # changed in the last 24 hours
find . -type f -mtime +30                   # older than 30 days
find /srv -user www-data -type d            # owned by a user
find . -type f -perm -o+w                   # world-writable files

Do something with the matches

find . -name '*.tmp' -delete                       # delete (test without -delete first!)
find . -type f -name '*.sh' -exec chmod +x {} +    # run a command on batches of matches
find . -type f -print0 | xargs -0 sha256sum        # safe with spaces in names

Always run the command once without -delete or -exec to see what it would touch. Put -maxdepth 1 before the tests to stay in one directory.