LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Listing Files with Certain Criteria (https://www.linuxquestions.org/questions/linux-newbie-8/listing-files-with-certain-criteria-709688/)

Nagglfar 03-06-2009 01:56 PM

Listing Files with Certain Criteria
 
If I wanted to do an ls or a listing of a subdirectory of files that were last modified in that directory in the past 30 minutes, how would I go about doing so?

For example, I want to do a listing of /var for only files that were created in the last 45 minutes.

Best regards

TB0ne 03-06-2009 02:11 PM

Quote:

Originally Posted by Nagglfar (Post 3467199)
If I wanted to do an ls or a listing of a subdirectory of files that were last modified in that directory in the past 30 minutes, how would I go about doing so?

For example, I want to do a listing of /var for only files that were created in the last 45 minutes.

Best regards

Easily done, check out the atime, mtime, and ctime switches. These pages:

http://www.linuxforums.org/forum/lin...ime-ctime.html
http://linuxpoison.blogspot.com/2008...and-mtime.html

Should give you a good start. Lots more info on these switches can be found through Google.

T74marcell 03-06-2009 04:16 PM

Checking the current directory for files accessed at least 45 minutes ago
find . -amin +45

To find the accessed between now and 45 minutes ago you probably have to write a script listing the +45 and +1 situation and using diff to sort them out.

Arch Linux

alan_ri 03-06-2009 04:36 PM

The easy way;
Code:

find /var -mmin -45


All times are GMT -5. The time now is 05:43 PM.