Find and search files
Find
Find allows searching file names and directories under the current location
Exclude specified pattern from find (eg. '*/\.git/*'
for ignoring .git
directories)
Show files that match the search criteria. The criteria can be a literal name or use wildcards *
(wrap non-alphanumeric search criteria with quotes)
Find files (-type f
), directories (-type d
) or both
Find files that match the file pattern and pass results to grep for searching file contents
Find folders that are at a certain depth with the specified name
Find files containing case insensitive <search-string>
somewhere in their name
Find files under path that match file pattern excluding those inside specified directory
Find files under path that match file pattern excluding those inside multiple directories
Notes on using find
-o
is an OR operator-prune
excludes directory contents from search-false
when paired with prune removes pruned directories name appearing in output
Grep
Output files with content matching (-l
) or not matching (-L
) the search string
Search files recursively for search string below path location
Search using extended regex (-E
)
Only show matches (-o
) and do not print filenames (-h
)
Advanced Grep Examples
Find files and print with sizes (Note: -printf
is not POSIX and only available with GNU find
)
Find files without *.orig
and format output to include timestamp and path, then sort and grab the first 100
Show files with non-ascii characters
List all image filenames
Last updated