edit SideBar

Main / Find

Pipe superfluous output to null

find <directory> -name <pattern> 2>/dev/null


The ! is a NOT for the find command.
To find more than one name match, use -o as in OR: find . -name "a" -o -name "b"

To return only executable files, use -type f -executable options.

For directories use -type d.

To ignore case, use -iname

For files greater than a certain size, use -size +100M for example for greater than 100MB.


To find all the C/C++ source files and headers: find . -type f -regex ".*\.*[ch]\(pp\)?$"

To find all the files modified in the last 10 minutes, use find . -mmin -10

Using wildcard *

The command find . -name *.c will NOT work because expansion happens before the argument is passed to find. Instead, you must use find . -name "*.c"

Page last modified on July 11, 2023, at 04:01 PM