🏡 Blamechance's Digital Cottage

Search

Search IconIcon to open search

bash-find

Last updated Sep 20, 2023 Edit Source

# Resources:

# Syntax:

1
2
3
4
5
6

find [where to start searching from]
 [expression determines what to find] [-options] [what to find]

e.g 
find "$MD_DIRECTORY" -name '*.md' -exec echo "File is: {}" \;

# Cheatsheet:

DescriptionSyntax
Search for all files of a patternfind ./GFG -name *.txt
Placeholder for “current file path of found object” -> {}find "$MD_DIRECTORY" -name '*.md' -exec echo "File is: {}" \;
To run a command after finding a file, use -execfind [location] -exec \;
To initiate a loop on a $pattern file, without splitting the lines into fieldswhile IFS= read -r pattern; do { code here }