What is wrong with 'find . -maxdepth 1 -ctime -7 -type f'?

Have you tried running the command below? On the same RHEl 6.8 or 6.6. It will give you different output.

find . -maxdepth 1 -ctime -7 -type f
rpm -qa|grep find
findutils-4.4.2-9.el6.x86_64

[root@soctxtwave06:~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)
[root@soctxtwave06:~]#

Um, okay. Please help us.

I assume the output differs on the very same directory tree. Could please post what you found as the difference?

find manpage: FWIW, and in case this is the result of not knowing about rounding, you may need to read this section. We get this question often.

(yes, I know it is about atime)

    -atime n
              File  was  last  accessed n*24 hours ago.  When find figures out
              how many 24-hour periods ago the file  was  last  accessed,  any
              fractional part is ignored, so to match -atime +1, a file has to
              have been accessed at least two days ago.

Next read the ctime piece, which refers back to atime

       -ctime n
              File's status was last changed n*24 hours ago.  See the comments
              for -atime to understand how rounding affects the interpretation
              of file status change times.
1 Like

THIS IS CORRECT,

-rw-r-----.  1 root domain users         81 Mar  7 15:51 aa
drwxrwxr-x. 13 root domain users       4096 Mar  8 14:25 development
drwxr-x---.  2 root domain users       4096 Mar 13 16:19 630
[root@server1:~]$  find .  -maxdepth 1 -type f  -ctime -7
./.bash_history
./aa
./.viminfo
[root@server1:~]$

Same release and find version

[root@server2 ~]# ls -lrt | tail -4
drwxr-x---. 2 root    root         4096 Mar  7 15:53 bin/
-rw-r-----. 1 root    root            0 Mar 13 17:52 asdas
-rw-r-----. 1 root    root            0 Mar 13 17:54 aa
-rw-r-----. 1 root    root            0 Mar 13 18:04 asdf
[root@server2 ~]#


root@server2 ~]#  find .  -maxdepth 1 -type f  -ctime -7
./.tcshrc
./get_index_data.pl.20150602
./install_trace.34856
./.bashrc.20161130
./.viminfo
./bondNIC.sh
./install.log.syslog
./tao-cosconcurrency.20160720
./ks-post.log.1
./asdf
./get_index_data.pl_ORIG
./getAttachmentNames
./twave05.key




# ll install.log
-rw-r--r--. 1 root root 28080 Feb 17  2015 install.log
[root@server2 ~]#

---------- Post updated at 02:42 AM ---------- Previous update was at 02:33 AM ----------

what funny is...my command works on my other rhel servers. the same command..atime is totally different as well as mtime..believe me..i ran all the tests.

Perhaps the atime and mtime really are different on that particular server, at no fault of find's.

Ok thank you..maybe we close this ticket

Maybe you thought there is a shared filesystem.
df . tells you the filesystem where the current directory is, and ls -lid tells the current directory's inode number.