Useful for finding files that contain text
Best flags
-i: ignore case-r: recursive (search all files below indicated path)-n: indicate line numbers-l: just list files-I: ignore binary files-E: use “extended” regular expressions# grep -[flags] "text string" path
grep -iIrl ssh-ed25519 ~/.ssh
grep -iIrn ssh-ed25519 ~/.ssh
regular expressions help: https://regexr.com/
-v: list what doesn’t match-w: list whole-word matches-F: plain text match (no regex)grep by itselfsearch for “searchtext”, ignoring case, ignoring binary files, recurisvely search, with line numbers, in this folder.
grep -Iirn "searchtext" .
Just list filenames
search for “searchtext”, ignoring case, ignoring binary files, recurisvely search, just returning filenames, in this folder.
grep -iIrl "searchtext" .
grep --exclude-dir="**.git**" --exclude-dir="**.ipynb_checkpoint**" --exclude="*.png" --exclude="*.svg" -iIrn "searchtext" .
grep -Iirl --exclude=*.svg --exclude-dir=**anaconda3** --exclude-dir=**Trash** tmux ~/
grep in a pipefind all processes named python
ps aux | grep python
grep -Iirl "hello" --include=*.{cc,h}
pcregrep -rIn -M "\n#{1} " --include=*.md .
sudo apt install -y libgtk-3-dev
pip install rummage