From the Linux command-line you want to search a directory structure of files and return the paths to all files that contain a particular string. What command do you use? (Because we all need daily #Linux #DFIR #CommandLine #Trivia)
Nov 10, 2022 · 1:43 PM UTC
11
3
34
Props to 🐘feld@bikeshed.party for the first correct answer to yesterday's #Linux #DFIR #CommandLine #Trivia: "grep -rl string /path/to/files"
1
1
Honorable mention to 🐘PhilHagen@infosec.exchange for improving the answer with "rail grep": "grep -rail string /path/to/files". That will get you case-insensitive matching.
1
Interestingly, the "-a" and"-l" options are redundant here. "-a" normally gives you matching strings from non-ASCII files. But since we're only printing file names ("-l"), it doesn't matter.
1
1




