Somewhere in a project there's a file you need, and you don't remember where. find walks through a directory and every directory inside it, and prints the paths that match:
find projects -name "*.md"The first argument is where to start (. for here); after it come the tests:
| Test | Matches |
|---|---|
-name "pattern" | names matching the pattern (* and ? work) |
-iname "pattern" | the same, ignoring case |
-type f | files only |
-type d | directories only |
-maxdepth 1 | stop one level down |
Tests combine: find projects -type d -name "s*" lists directories starting with s.
Quote the pattern. Unquoted, the shell expands *.md in the current directory first, and find gets the wrong question (or an error saying "paths must precede expression").
Searching inside files
find looks at names. To look inside files, use grep with -r (recursive), which searches every file under a directory:
grep -r TODO projects-l prints only the names of the files that match, which is handy when the matching lines are long.