Best command to find files

12-18-2021
Recursively search for a text in files.

There is a bug in Nemo (Linux Mint's file manager) that prevents you from recursively searching for files with a certain extension.

To prove this is a bug I searched for translate in the 1000+ OpenScad files I have in my project folder. Result: nothing found. huh?? WTF ??


Solution: command line. I prefer to use grep over find because grep is really fast.

The line below recursively searches (subfolders) for the text "230V".
grep -rin --include="*.scad" '230V' | less

Context and colors
The line below also searches for "230V" but gives 3 lines before and after each "230V" found and shows colors.
grep -rinC 3 --color=always --include="*.scad" '230V' | less -R

★ㄥinuメ★ TᎥƤ乙

View all 40 tips
or follow the
RSS-feed.
 
×
×