I just created a text-file yyy in my home-directory. I modified it both with touch yyy
and edited it manually.
Then I wanted to find this file (and others) via:
find ~/ -type f -mtime 1 -ctime 1 | grep yyy
but yyy isn't displayed. In find's man it is written:
-ctime n: File's status was last changed n*24 hours ago. …
-mtime n: File's data was last modified n*24 hours ago. …
So my first question is:
Why isn't yyy found
My second question is:
Does changed file's status mean: Changed content of file & permissions of file & …?
Does modified file's data mean: Changed content of file?
Best Answer
Yes, "modified file's data" (
mtime
) means that the content was modified. This date can be manually changed (e.g. withtouch
).Yes, "changed file's status" (
ctime
) means that either the content was changed, or the file's metadata (permission, owner, etc). This can not be changed manually.Example:
Your file is not found because your
find
predicates-mtime 1
and-ctime 1
search for a file that was modified yesterday (more exactly between 24h ago and 48h ago). For a file that is modified today, use either-mtime 0
or-mtime -1
(same for-ctime
).Example: