cancel
Showing results for 
Search instead for 
Did you mean: 

find with amin and cmin

Beginner_2
Occasional Advisor

find with amin and cmin

Hi,

i dint understand what is mean by below options of find command:

-amin n
file was accessed n minutes ago

-cmin n
file's status was changed n min ago

So what operation includes in accessing file and file status get's changed? OR
when can we say file is accessed and file status is changed?

Thanks.
6 REPLIES
Pete Randall
Outstanding Contributor

Re: find with amin and cmin

What version of HP-UX are you running?


Pete

Pete
James R. Ferguson
Acclaimed Contributor

Re: find with amin and cmin

Hi:

Unix keeps three timestamps, each measured in seconds from the Epoch -- January 1, 1970 @ 00:00 UTC.

The 'mtime' (last modification time) represents the last point at which the file or directory was modifed.

The 'atime' is the last access timestamp and shows when a file or directory was last read or executed.

The 'ctime' represents the last *change* time. Alterations in permissions, ownership and/or the name of a file or directory alter the 'ctime'.

Many backup utilities will reset a file's lastaccess time ('atime') after a file is backed up. This operation restores the 'atime' but in doing so changes the 'ctime' to the time of the change operation.

Regards!

...JRF...
Regards!

...JRF...
Jose Mosquera
Honored Contributor

Re: find with amin and cmin

Hi,

To clarify your doubt please:
#man stat(2)

Here please check the st_atime and st_mtime.

The field st_atime is changed by file accesses, e.g. by execve(2), mknod(2), pipe(2), utime(2) and read(2) (of more than zero bytes). Other routines, like mmap(2), may or may not update st_atime.

The field st_mtime is changed by file modifications, e.g. by mknod(2), truncate(2), utime(2) and write(2) (of more than zero bytes). More-over, st_mtime of a directory is changed by the creation or deletion of files in that directory. The st_mtime field is not changed for changes in owner, group, hard link count, or mode.

An example of these may be:
#find /tmp -type f -cmin 15 -exec ls -l {} \;

List all files in /tmp directory that have been changed (content modified) in last 15 minutes.

Rgds.
Dennis Handly
Acclaimed Contributor

Re: find with amin and cmin

>I didn't understand what is mean by below options of find command:

These options don't exist on HP-UX find(1), perhaps gnu find instead.
Beginner_2
Occasional Advisor

Re: find with amin and cmin

Hi,

I am trying to learn HP-UX 11iv3 and just while reading , the doubt came in my mind about access , modification and change time and i put the question here.
I understood the concept of these time and thanks a lot for replies.
Just sorry , i didn't mentioned version and it was just general question

Thanks,
Rahul
Beginner_2
Occasional Advisor

Re: find with amin and cmin

I understood the concept of times.