LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-06-2009, 02:56 PM   #1
Nagglfar
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Rep: Reputation: 0
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
 
Old 03-06-2009, 03:11 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,921

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by Nagglfar View Post
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.
 
Old 03-06-2009, 05:16 PM   #3
T74marcell
Member
 
Registered: Mar 2009
Posts: 102

Rep: Reputation: 18
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

Last edited by T74marcell; 03-14-2009 at 02:03 AM.
 
Old 03-06-2009, 05:36 PM   #4
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
The easy way;
Code:
find /var -mmin -45
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a single "Find" Command to find files bases on multiple criteria roboxooo Linux - Newbie 6 01-15-2009 05:13 AM
Help with listing files sandeshsk007 Linux - Software 10 12-07-2007 05:04 PM
listing files and burning files - just a question radiodee1 Debian 1 11-26-2006 08:29 AM
listing files in a directory Linh Programming 7 05-17-2004 05:35 AM
listing files in apache im1crazyassmofo Linux - Software 0 07-27-2003 06:05 PM


All times are GMT -5. The time now is 08:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration