Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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