System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

find command with newera option like HP-UX on RHEL5

Mike_Swift
Advisor

find command with newera option like HP-UX on RHEL5

To find the files created/accessed in the last <n> minutes, on HP-UX we use find with -newera option after touching 2 files with different timestamps and comparing them (with find / -newera file1 ! -newera file2). What would be a similar command in Linux? Thanks in advance!

 

Mike.

4 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: find command with newera option like HP-UX on RHEL5

Hi:

 

Enlightenment can be found in the manpages :-)  That said, Linux supports find() options like '-daystart' which alters the notion of a "today" for the options '-[acm]min' and '-[acm]time' in additon to the '-[acm]newer file'.

 

Based upon your question, you would want something like:

 

# find . -type f -mmin -30 -print

...to find files last modified with 30-minutes of the current time.

 

Regards!

 

...JRF...

Mike_Swift
Advisor

Re: find command with newera option like HP-UX on RHEL5

Hello JRF

 

find with -mmin would only give the files modified, i also want to know files accessed (that is what -newera on hp-ux would do). so what i would do is the following

 

1. touch filea

2. sleep for n seconds

3. touch fileb

4. use the find command to see what all files where accessed/modified etc in the last n seconds.

 

I want to do that in RHEL 5 linux.

 

Thanks

 

Mike

James R. Ferguson
Acclaimed Contributor

Re: find command with newera option like HP-UX on RHEL5


Mike_Swift wrote:

find with -mmin would only give the files modified, i also want to know files accessed (that is what -newera on hp-ux would do). so what i would do is the following

 

...

 

I want to do that in RHEL 5 linux.



# find . -type f -amin -30 -print

 

...to find files last *accessed* within 30-minutes of the current time.

 

Regards!

 

...JRF...

Goran Koruga
Honored Contributor

Re: find command with newera option like HP-UX on RHEL5

Hello.

 

Well GNU find also supports "-newerXY" switch, "-not/"' and the "-a/-and" one.

 

info find -> Finding Files -> Time -> Comparing Timestamps

 

info find -> Finding Files -> Time -> Age Ranges

 

That should be enough to do what you want.

 

Regards,

Goran