I'm trying to understand the output of the find command with the -cnewer test. In doing some limited testing, this is what I get.

First, I created a file:

cd ~/Documents
touch file1.txt

Then I waited a few minutes before creating another file:

touch file2.txt

Then I decided to compare the content timestamp to the metadata timestamp by doing:

ls -lht (for content timestamp)
-rw-rw-r-- 1 mason mason    0 Aug 11 01:19 file2.txt
-rw-rw-r-- 1 mason mason    0 Aug 11 01:17 file1.txt

And then:

ls -lhtc (for metadata timestamp)
-rw-rw-r-- 1 mason mason    0 Aug 11 01:19 file2.txt
-rw-rw-r-- 1 mason mason    0 Aug 11 01:17 file1.txt

So far no surprises, since I haven't done anything to change the metadata timestamp.

Now if I type:

chmod 664 file1.txt

to change the metadata timestamp, and then look at the output again:

ls -lhtc
-rw-rw-r-- 1 mason mason    0 Aug 11 01:23 file1.txt
-rw-rw-r-- 1 mason mason    0 Aug 11 01:19 file2.txt

file1.txt appears in first position in the ls -lhtc output, but still in second position in the ls -lht output, also as expected.

Finally, if I decide to type:

cd ~/Documents
find . -cnewer file1.txt

I get:


Here are the questions I have:

  1. What does -cnewer look for? Does it look to see if the metadata timestamp has changed or does it look for whether the content timestamp has changed? Does it do both? I'm pretty sure it does both, but I'd like to be sure.

  2. If -cnewer does both, why does file1.txt end up in the output? I can understand why file2.txt ends up in the output, since find will look for a more recent content timestamp than file1.txt, but I still don't understand why file1.txt ends up in the output. After all, there is no file with a more recent metadata timestamp in the ls -lhtc output than file1.txt.

1 Answer 1


From the manual (bold mine):

— Test: -anewer file
— Test: -cnewer file
— Test: -newer file
True if the file was last accessed (or its status changed, or it was modified) more recently than file was modified. [...]

So the tests compare the atime, ctime and mtime respectively with the mtime of the specified file.

If you want to compare ctime with ctime, then use the -newerXY tests:

find . -newercc file1.txt

So, the -*newer tests are shorthand for -newer*m.

  • The info you got from the FSF manual is much more clearer than the man page from the terminal. Thanks. Aug 12, 2017 at 6:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .