Linux: Find files changed or modified within xx day or older than xx day

by Yang Yang on September 9, 2009

One of the utility commands of Linux that you should know in the first day of your Linux learning seminar is find.

To search recursively in the directory somedir for files changed / created / modified within 1 day:

find somedir -ctime -1

Or within 5 days:

find somedir -ctime -5

To search recursively in the directory somedir for files changed changed / created / modified more than 1 days ago:

find somedir -ctime +1

Or more than 5 days ago:

find somedir -ctime +5

To search recursively in the directory somedir for files modified within 1 day:

find somedir -mtime -1

To search recursively in the directory somedir for files modified more than 1 days ago:

find somedir -mtime +1

Or more than 2 weeks ago:

find somedir -mtime +14
Pradeep August 18, 2010 at 7:07 pm

Using this, I will try to find which images have been uploaded recently(within 7 days), by my users. And may be their size also.

find /public_html/upload/ -regex “\.gif|\.png|\.jpg|\.jpeg” -mtime -7

Reviews welcome.

Comments on this entry are closed.

{ 1 trackback }

Previous post:

Next post: