How can I find the file which is of 30 minutes old in /bin/ksh?

  • 6
    Do you mean "had its contents changed 30 minutes ago" or "did not exist until it was created 30 minutes ago"? Also, what operating system are you using? Different operating systems come with different versions of find. Jul 18, 2014 at 15:44
  • @ Mark Plotnick i want to find the file which were of 30 minutes old
    – Aravind
    Jul 19, 2014 at 5:14
  • I think he/she means was created 30 minutes ago. As if e.g. someone is X old, he/she was born X time ago.
    – erik
    Jul 19, 2014 at 23:19

3 Answers 3


On Linux, there is no track of the creation time of a file. You can only access:

  • the last modification time of the content (a creation counts as a modification of course), mtime,
  • the last access time, atime,
  • the last modification time of the meta-data, ctime.

If you want to look for files with a test based on these times, find (man find) can help you.

You would use it this way to find a file accessed exactly 30 minutes ago in your current directory and its subdirectories:

find -amin 30

Usually, you'll want to use an interval as it can be difficult to give an exact number of minutes:

find -amin +25 -amin -35

This will find files accessed more than 25 but less than 35 minutes ago.

And if you're interested only in modification time and not in access (i.e. read) time, replace -amin with -mmin.

  • you don't want atime. atime is access time. Jul 18, 2014 at 16:08
  • @richard The OP didn't specify what he meant so... Anyway I put mtime too in the answer
    – lgeorget
    Jul 18, 2014 at 19:17
  • 1
    @ lgeorget when i use -mtime 30 it was showing the files 30 days old.
    – Aravind
    Jul 19, 2014 at 3:21
  • @user2910201 Ups stupid me. Xtime options are for days and Xmin options for minutes. My bad, I edit the answer
    – lgeorget
    Jul 19, 2014 at 20:14
  • 3
    @user2910201 but note that you can use Xtime with any reasonable time unit like 30m for thirty minutes, or 5d for five days
    – lgeorget
    Jul 19, 2014 at 20:19

You can use mtime to do so:

find . -mmin 30    #exactly 30 minutes old
  • this will tell you the files which was created or modified 30 minutes back
    – g4ur4v
    Jul 18, 2014 at 15:36
  • @ g4ur4v when i use -mmin it is showing -mmin is not a valid option
    – Aravind
    Jul 18, 2014 at 15:44
  • Try this out: find /path -mtime +30m
    – ryekayo
    Jul 18, 2014 at 15:45
  • Not sure why it's not recognizing -mmin, I've looked up many examples using that command..
    – ryekayo
    Jul 18, 2014 at 15:46

With out GNU/BSD find

TZ=ZZZ0 touch -t "$(TZ=ZZZ0:30 date +%Y%m%d%H%M.%S)" /reference/file

and then find . -newer /reference/file

solution given by Stéphane Chazelas

Not the answer you're looking for? Browse other questions tagged or ask your own question.