Linuxlab

find command in Linux: search for files

Updated July 3, 2026

The find command walks a directory tree and finds files by name, type, size, or time.

Syntax

find [path] [tests] [actions]

The first argument is where to look. Then come the tests, and find checks them left to right for every file.

Common cases

find . -name "*.log"        # by name, from the current directory down
find . -type d               # directories only
find . -size +10M            # files larger than 10 megabytes
find . -mtime -1             # changed in the last 24 hours
find . -name "*.tmp" -delete # find and delete

How it works: tests and -exec

-name matches the file name only, not the whole path, and understands the * and ? patterns (quote them so find expands the pattern, not the shell). The action -exec command {} \; runs a command for each match, putting the path where {} is.

Try it

Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand. The container is deleted when you leave, so there is nothing to be afraid of breaking.

Where this is in the book: the chapter Files and directories.