Thursday, October 06, 2022

finding files from linux command line

This is something which I keep needing. For a filename based search,


find /path/to/search -name "*partoffilename*"

For a substring inside the file,

grep -rn /path/to/search -e "substring to look for"
https://stackoverflow.com/questions/16956810/how-to-find-all-files-containing-specific-text-string-on-linux

first arg is path to search
-r recursive
-n show line numbers
-e pattern

No comments:

Post a Comment