find recently modified/ updated file

hi gurus,

i would like to know how can i find logs files which were recently modified or updated? :confused:

using this command?

find . -name "*.log" -mtime ??

so what should i put for mtime?

thanks.

wee

I don't think using find command will satisfy your requirement unless you want to recurse into directories.

If all the log files are located in the same directory, then use the below command. This will list the latest 10 files in ascending order with the latest file at the end.

If you want more log files to be displayed, use tail -<number> to display as many files as you want.

ls -lrt | tail

HTH,:cool:

Regards,

Praveen

If you want stuff from within the last hour, use -1. If you want stuff less than five hours old, use -5. If you want to control the time by minutes instead of hours, use mmin instead.

thanks shawn for the infor. i think that should work...let me try it out.

hi shawn,

what if i need to check which files have been modify or updated over the past few days? do i use -mtime +72 for files which have been modified for the past 3 days etc?

The opposite -- +72 will give you things modified more than 72 hours ago, -72 would be less than 72 hours.

ahh...yes should have guess its a - than a +. this should work now. thanks shawn!

that works...
-24 --- in the past 24 hours +24 before one day

Hi all,,,,
when i try using the find command with -mtime -1 i get the files for the 24hrs from the current time.
I am not getting it on an hourly basis.
can u please suggest on this.

My requirement is to get files for the past 2 hrs from the current time from a directory....

thanks in advance ..

you can specify in minute .here i have specified for 1 hr / 60 mins

find /mydirectory/ -mmin +60

you can try amin inplace of mmin