find

Find may be used to find files or directories in the file system. find is by default recursive. To avoid recursion you may specify maxdepth option. The following example list only the directories the current folder.

find . -maxdepth 1 -type d

When using complicated expressions in find it is important to escape special characters with backslash (\). See for instance the following "not equal to" expression.

find . \! \( -name *.jpg \)

Sometimes you want to pass the result of find to another command like grep. To do this you can use xargs to pass the result of one command to the next.

find . -name "*.foo" | xargs grep bar

References