Find command don't output anything, but file is there

Please if You can help me debug why nothing is found by this command?

[root@hostname cron.hourly]# echo "Zeus Robot" >> /home/vps/190/test
[root@hostname cron.hourly]# cat /home/vps/190/test
Zeus Robot
[root@hostname cron.hourly]# find /home/vps -type f -mtime 2 -size -1000k -exec grep -l "Zeus Robot" {} \; >> out
[root@hostname cron.hourly]# cat out
[root@hostname cron.hourly]# cat /home/vps/190/test
Zeus Robot

Why that FIND command did not outputted anything while there is "test" file with that content?

Because the file /home/vps/190/test was only just created and not two days old like mtime specifies.

1 Like

You probably meant -mtime -2 , for modified in the last 2 days

1 Like

actually i need to find files that are 2 hours and younger... 8-I

Then you want -mmin -120

1 Like

Thank you for helping me point me to wrong -mtime argument. It appears to be solved

---------- Post updated at 10:26 AM ---------- Previous update was at 09:45 AM ----------

there is strange thing..

This script:
find $wheretosearch -type f -mmin -90 -size -1200k -iname '.php' -o -iname '.js' -exec grep -l "$phrasse" {} \; >> $outputfile

found me this file:

# stat injection_graph_func.js
  File: `injection_graph_func.js'
  Size: 14500           Blocks: 32         IO Block: 4096   regular file
Device: 903h/2307d      Inode: 111126778   Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-02-06 10:01:13.000000000 +0100
Modify: 2011-07-26 10:27:50.000000000 +0200
Change: 2013-11-21 14:29:51.000000000 +0100

as You can see, file dont match my command, i thought "-mmin -90" will search only files modiffied/created last 90 minutes, but above mentioned file appears to be there for much longer time?

The trouble is with -o , the effect of which in this case is that *.php files have this restriction, but *.js files don't. You would need to use additional grouping operators \( and \)