Operating System - HP-UX
1819805 Members
2992 Online
109607 Solutions
New Discussion юеВ

what's the difference of -ctime and -mtime in find command?

 

what's the difference of -ctime and -mtime in find command?

find / -ctime +2
find / -mtime +2

thanks everyone
2 REPLIES 2
Pete Randall
Outstanding Contributor

Re: what's the difference of -ctime and -mtime in find command?

mtime refers to the modification time of the file, while ctime refers to a change in the status information of the file. For example, you could use the touch command to alter the date of the file (the status information), without actually changing the file itself.

At least that's the way I interpret it.


Pete

Pete
Fred Ruffet
Honored Contributor

Re: what's the difference of -ctime and -mtime in find command?

Pete's right. Even if you can chnge both change and modification with touch (-c or -m).

You have 3 dates for a file :
. ctime : change time. It gives you the last time a modification was done on the inode. For example chmod. You can see it with ls -lu file.
. mtime : modification time. It gives the last time the file content was modified. For example with vi. It is the one normally displayed by ls -l.
. atime : access time. It gives you the last time the file was accessed. Even cat modifies this date.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)