Find

Syntax

command syntax description
find find <path> -name <file> searches the filesystem with the given string
find <path> -name <file> [command] runs the given command on the file-paths that find returns
unlike the locate command, find will do a 'live' search through your system and return all paths that contain the given string. Results are up to date, so if you create or delete a file and then run a search, the results from find will reflect that.

find is a more granular type of search.

find is CPU intensive compared to locate

Examples

find / -name *.conf - returns a list of all file-paths that contain the string .conf (so basically all the .conf files)

sudo find / -name '*.tmp -exec wc -l "{ }" \; performs a live search for all files with .tmp in the name, starting at the / path. it returns all the file-paths that that match the search, then it runs wc -l " " on each of those paths in order. Or simply put, it finds all .tmp files in the entire system and counts the number of lines in each file


find which apropos