Find files with certain text
grep -r "Text to find" PATHIf you just want the file names
e.g. grep -r "bad text" /home/user/www/
grep -r "Text to find" PATH | cut -d: -f1If you want to find certain files
e.g. grep -r "bad text" /home/user/www/ | cut -d: -f1
find . -type f -name "101.php"Wildcards work too
for a case insensitive search
find . -type f -iname "101.php"
find . -type f -name "*.php"Suppose you want to find all the files modified between a certain dates. This works
for a case insensitive search
find . -type f -iname "*.php"
touch -t yyyymmddhhmm tempfile1
touch -t yyyymmddhhmm tempfile2
find /www/ -type f -newer tempfile1 -not -newer tempfile2
e.g.Find specific files, e.g. php files, between certain dates
touch -t 201510010000 /tmp/startfile
touch -t 201510010000 /tmp/endfile
find /www/ -type f -newer /tmp/startfile -not -newer /tmp/endfile
touch -t yyyymmddhhmm tempfile1
touch -t yyyymmddhhmm tempfile2
find /www/ -type f -name "*.php" -newer tempfile1 -not -newer tempfile2
e.g.References
touch -t 201510010000 /tmp/startfile
touch -t 201510010000 /tmp/endfile
find /www/ -type f -name "*.php" -newer /tmp/startfile -not -newer /tmp/endfile
- Mommy, I found it! — 15 Practical Linux Find Command Examples
- Daddy, I found it!, 15 Awesome Linux Find Command Examples (Part2)