snippets > quick-usage-examples-of-find-on-command-line

August 03, 2020

Quick usage examples of "find" on the command line

Search recursively for files using a regex pattern. Use -name for a case sensitive search.

find . -iname '<partial_name>*'

Execute a command with every result found.

find . -iname '*.md' -type f -exec ls -lh {} \;

Note: every command needs to be terminated by ; or +. But these signs may need to be escaped as in ; or \;. Outputs given by find will be placed on {}. Multiple uses of -exec are allowed.