Searching with find and grep
man find tells you everything, but these are the ones we use:
| command | what it does |
|---|---|
find . -name file_name -print |
search the current folder and below |
find ~ -name ".DS_Store" -delete |
delete .DS_Store files |
find . -type f -print | egrep -i '\.m4a$|\.mp3$' |
all .m4a or .mp3 files |
find . -type f -print | egrep -i '\.m4a$|\.mp3$' | wc -l |
count them |
find foo -name \*.txt |
find all .txt files in foo |
grep -r pattern folder/to/search |
search through a folder |
grep "my string of text" -r |
search folders & subfolders |