find files containing a text
Search every file under a folder for a word or a phrase, and show where it is.
filestextsearch
-
grep -rn 'some text' .every line containing the text, under this folder, with file and line number
-
grep -rl 'some text' .only the names of the files that contain it
-
grep -rni 'some text' .the same, ignoring upper and lower case
-
grep -rnw 'word' .only where it is a whole word
-
grep -rn --include='*.py' 'some text' .only in the files of one kind
-
grep -rn --exclude-dir={.git,node_modules} 'some text' .skipping folders you do not want searched
-
rg 'some text'the same, faster, with ripgrep, which skips what .gitignore lists
-Iskips binary files, and2>/dev/nullhides the files you may not read.
greprgfind
Each has a page in lore: lore grep opens it.
compare two folders
Find which files differ between two folders, or are only in one of them.
count lines, words and files
Count the lines of a file or of a command's output, the words, and the files in a folder.
delete lines containing a text
Remove every line of a file that contains a word, or keep only those lines.
exclude a folder from find
Search with find without going into folders like .git or node_modules.