Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a script file *.ksh very recently and I want to get a list of the last modified/created *.ksh files.

I am sure you can somehow do it using find, just not sure how.

share|improve this question
up vote 2 down vote accepted

find . -name "*.ksh" -amin -10

will give you *.ksh files under the current directory tree that were accessed less than 10 minutes ago.

On a more general note, use

find . -name ".ksh" -amin n

where

 Numeric arguments can be specified as
   +n     for greater than n,
   -n     for less than n,
   n      for exactly n.

and one of:

   -amin n
          File was last accessed n minutes ago.

   -cmin n
          File’s status was last changed n minutes ago.

   -mmin n
          File’s data was last modified n minutes ago.


   -atime n
          File was last accessed n*24 hours ago.  When find figures out how many 24-hour periods ago the file was last
          accessed,  any  fractional part is ignored, so to match -atime +1, a file has to have been accessed at least
          two days ago.

   -ctime n
          File’s  status  was  last  changed  n*24  hours ago. 

   -mtime n
          File’s data was last modified n*24 hours ago.
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .