Commands

find

[path…][expression]

The find command searches the directory tree specified by the path argument for the pattern(s) indicated in the expression argument.

The expression consists of options, tests, and actions. Options affect overall operation rather than the processing of a specific file. Tests return a true or false value based on evaluation of some condition. Actions have side effects and return a true or false value.

Example: To search the entire system for a file named “abcd.txt”, use

find / -name abcd.txt -print

Example: To search all the files in the directory tree of user “someguy” for the string “blah”, use:

find /home/someguy -type f -print |xargs grep -n “blah”

A common mistake with the find command is assuming that ...

Get Linux® Desk Reference, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.